c# - Using LINQ to convert array object[,] to array -


i have information external system return me in following format:

sap data

i required convert information object[,] array split on "|". i'm been using linq in vb information:

dim vsapdatatemp(,) object = local_saptabledata.data  dim vlinq = tempresult in vsapdatatemp             select value = array.convertall(tempresult.tostring.split(rfc_delimiterchar),                                     function(vval) cobj(vval.tostring.trim))  dim vnewsapdata() object = vlinq.toarray 

but i'm moving c# , i'm stuck following error:

linq error

when using code:

var vsapdatatemp = local_saptabledata.data;  local_saptabledata.freetable(); fw.gccleaner(); local_saptabledata = null;  var vlinq = (from tempresult in (vsapdatatemp object[,])                        select string strvalue = array.convertall(tempresult.split(stcvariables.strsaprfcdelimiterchar),                             vval => (vval object).tostring().trim()));  var vnewsapdata = vlinq.toarray<string>(); 

what (if any) workaround exists issue?

you have use cast call:

from tempresult in (vsapdatatemp object[,]).cast<object>() (...) 

that's because object[,] implements non-generic ienumerable doesn't work linq. (i have no clue why works in vb.net begin with).


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -