Hi, I have a list xxx which likes
Code:List<string> xxx = new List<string>(); // add elements to xxx. xxx ={a,b,c,t} //xxx is very long thousands of elements // read a matrix from a text file. yyy[0] ={a,1,2,3,5}; yyy[1] ={b,2,4,6,7}; yyy[2] ={c,2,7,9,7}; yyy[3] ={d,21,4,16,7}; yyy[4] ={e,12,34,65,77}; yyy[5] ={t,2,4,6,7}; yyy[6] ={z,52,4,6,7}; // etc... just an example
I want to retrieve a matrix from yyy in which the first column is contained in the list xxx. How to do it? I splitted each line of yyy.
But it is very slow, is there a better way such as SelectMany in linq?Code:string[] fields =yyy[i].split('\t'); if(xxx.contains(fields[0]) //...
Thanks!




Reply With Quote