c# - System.Data.EnumerableRowCollectionExtensions.Cast error -


i'm getting error @ cast<datarow> saying

 system.data.enumerablerowcollectionextensions.cast<tresult (system.data.enumerablerowcollection)' 'method`  

which not valid in given context.

thanks help. below code

stringbuilder sbtmp = new stringbuilder(); dtmessage.asenumerable().cast<datarow>.tolist.foreach(x =>    sbtmp.appendline((x["segmmessage"]).tostring())); 

you forgot parentheses invoking cast , tolist methods:

.....cast<datarow>().tolist().... 

in c# need use parentheses invoke method , evaluate result. otherwise compiler thinks you're trying refer physical method itself in code, not result.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -