How can I iterate over C # IEnumerable in Matlab?

I have Linq to SQL code in C # that I am trying to get using Matlab 2010b. If my Linq code returns a single instance of an element, I can access all the properties without problems in Matlab:

dal = Data.PeopleRepository
person = dal.QueryPersonById(1)
person.Name

ans = 

John Smith

But if I call a Linq query that returns an IQueryable collection (actually the System.Data.Linq.Table class), I struggle to get into the list of Person instances inside!

people = dal.QueryAllPeople()

people = 

System.Data.Linq.Table<Data.Person> handle
Package: System.Data.Linq
Properties:
   Context: [1x1 Data.PeopleRepository]
   IsReadOnly: 0

I tried converting to IEnumerable using the GetEnumerator method for people, but I still cannot get the actual instances of Person inside. (I know that due to the late evaluation, the values ​​may not yet be retrieved from the database too! Aarggh!) Any pointers rated and apologized if this is unclear is my first StackOverflow question ...

+5
2

Matlab # ( Matlab #), , , IQueryable IEnumerable .

people = dal.QueryAllPeople().ToList() people = dal.QueryAllPeople.ToArray() - - , , Matlab.


- - -... , :

myEnumerator = dal.QueryAllPeople().GetEnumerator()
myEnumerator.MoveNext()
firstItem = myEnumerator.Current
firstItem =

myEnumerator.MoveNext()
secondItem = myEnumerator.Current
secondItem =
+2

. . .

, IEnumerable.ToArray() . , . System.Linq.Enumerable.ToArray<T>(this IEnumerable<T>). Matlab this. , , Matlab. NET.invokeGeneric.

Matlab.

ret = double(NET.invokeGenericMethod('System.Linq.Enumerable', 'ToArray', ...
   {'System.Double'}, enumerableInstance));

IQueryable<T> : IEnumerable<T>, (ToArray()) . Matlab (Data.Person, ).

Enumerable Matlab .NET 3.0.

NET.addAssembly('System.Core');

.

+8

All Articles