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 in end want call tolist on query, exception tolist not found on type.nestedtableitem
along side string.
.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
Post a Comment