[Mono-devel-list] Returntype of System.Data.DataTable.Select

gerhard at ibrittweger.de gerhard at ibrittweger.de
Wed Apr 13 11:54:22 EDT 2005


Hello,
thank you Konstantin for providing the sample.
With a little modification in testTypedDS()
	...
	RegionRow[] rows = (RegionRow[])regionDataSet1.Tables[0].Select("RegionID > 0");
	Console.WriteLine(rows.GetType().ToString());
you get
- with MS-Framework
	"tests.RegionDataSet+RegionRow[]"

- with mono
	Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type.
	in <0x0008b> tests.RegionDataSet:Main ()

I hope this clarifies my suggestion

This is my first participation within your List, so i hope i did it right

Regards,
Gerhard Rittweger

Atsushi Eno schrieb:
> Hello,
> 
> Konstantin Triger wrote:
> 
>>Hello,
>>
>>Attached the RegionDataSet.cs and a region.xml files.
>>When the following code is run, this type should be outputted: 
>>tests.RegionDataSet+RegionRow
>>
>>static void testTypedDS() {
>>           RegionDataSet regionDataSet1 = new RegionDataSet();
>>           regionDataSet1.ReadXml(@"region.xml", XmlReadMode.DiffGram);
>>           DataRow[] rows = regionDataSet1.Tables[0].Select("RegionID > 
>>0");
>>           Console.WriteLine(rows[0].GetType().ToString());
>>       }
> 
> 
> Actually mono also prints "tests.RegionDataSet+RegionRow". I think
> if there is a problem then it will reside in the generated code
> from our TypedDataSetGenerator. Since your .cs file seems created
> from MS.NET, it won't differentiate the result.
> 
> Can you please attach the source XSD ? (I guess you created it from
> xsd.exe.)
> 
> 
>>BTW, this fix, along with many others fixes by Mainsoft are currently 
>>being reviewed by Uma and Suresh and will be available soon to dev-list 
>>review (not in the HEAD branch).
> 
> 
> cool. So we can review them and probably fix them as well. Not sure
> how you needed different branch though.
> 
> Atsushi Eno
> 




More information about the Mono-devel-list mailing list