vb.net - Why can't I call ToList on a WhereSelectEnumerableIterator(Of T, String) -




i'm trying use linq extract values set of items. there possibility field doesn't exist, or empty, want filter fields not null , not empty. field values of numeric type , want project them string. return on query whereselectenumerableiterator(of nestedtableitem, string). edit: looks appropriate return type. i'm struggling understand why still projecting nestedtableitem along side string. in end want call tolist on query, exception tolist not found on type.

.net version: 4.5.1

references: microsoft.visualbasic, system, system.core, system.io, system.linq, system.runtime, system.xml, system.xml.linq

imports: imports system, imports system.text, imports system.collections.generic, imports system.linq, imports system.runtime.compilerservices, imports system.xml, imports system.io

dim aasitems ienumerable(of nestedtableitem) = aastable.nestedtableitems dim query = item in aasitems             let field = item.allfields.valuefields.find("aasproposedtotalmincredithours")             field isnot nothing andalso not field.isempty             select new string(field.numeric9value.tostring()) dim aasminstringlist = query.tolist() 

specific exception message:

public member 'tolist' on type 'whereselectenumerableiterator(of nestedtableitem,string)' not found.

thanks in advance!

edit: updated title better match question.

i able resolve casting query ienumerable(of string).

dim aasitems ienumerable(of nestedtableitem) = aastable.nestedtableitems dim query ienumerable(of string) = _              item in aasitems             let field = item.allfields.valuefields.find("aasproposedtotalmincredithours")             field isnot nothing andalso not field.isempty             select new string(field.numeric9value.tostring()) dim aasminstringlist = query.tolist() 

i'm still unsure why original code did not work. if has insight, i'd appreciate understanding more.





wiki

Comments

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

python - Minimize function with Scipy minimize -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -