mercredi 31 décembre 2014

Type.GetMember is not finding AsEnumerable

The type System.Data.DataTable, when calling GetMembers, does not return AsEnumerable in the results.


To confirm this, I ran:



Dim Query = From MemberInfo As MemberInfo
In GetType(DataTable).GetMembers
Select MemberName = MemberInfo.Name
Order By MemberName
For Each MemberName As String In Query.ToList
Debug.WriteLine(MemberName)
Next


Note that System.Data.DataSetExtensions is added as a reference, and there is a "using" (Imports) for System.Data


I am looking for the right code to get the MemberInfo for AsEnumerable.


Also note that I will not know the Type at runtime, I'm just using this as a concrete example, so I can't hard-code the solution for DataTable. I do realize the problem lies elsewhere, is not specific to DataTable methods, but I think by concrete example of a problem / solution I can extrapolate that to work with every Type.






Aucun commentaire:

Enregistrer un commentaire