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

Atsushi Eno atsushi at ximian.com
Wed Apr 13 02:01:23 EDT 2005


gerhard at ibrittweger.de wrote:
> I think there is an error in System.Data.DataTable.Select (IExpression 
> filter, SortableColumn [] sortableColumns, DataViewRowState recordStates)
> If you use a typed dataset with your own Datarow class derived from 
> DataRow und
> use an Select on your DataTable class derived from DataTable the select 
> has to
> return an array of your DataRows insteat of base-Class Datarows.


> In DataTable.cs Line 1317
> DataRow[] dataRows = (DataRow[])rowList.ToArray(typeof(DataRow));
> typeof(DataRow) has to be replaced by GetRowType()
> DataRow[] dataRows = (DataRow[])rowList.ToArray(GetRowType());

Am attaching an example case that the existing expression is not
wrong by concept.

If you have concrete example case, please enter it to bugzilla.

using System;
using System.Collections;
using System.Xml;

public class Test {
   public static void Main () {
     ArrayList al = new ArrayList ();
     XmlDocument doc = new XmlDocument ();
     al.Add (doc.CreateElement ("foo"));
     al.Add (doc.CreateAttribute ("attr"));
     al.Add (doc.CreateEntityReference ("ent"));
     XmlNode [] nodes = (XmlNode []) al.ToArray (typeof (XmlNode));

Atsushi Eno

More information about the Mono-devel-list mailing list