c# - LINQ conversion to List object -


i using following code return ilist:

filename = path.getfilename(files[i]); ilist<datax> querylistfromftp = datax.getlistfromftp(filename); querylistfromftp = (ilist<datax>)querylistfromftp     .select(x => new { x.user_id, x.date, x.application_id })     .tolist()     .distinct(); 

however keep getting error:

unable cast object of type 'd__7a1[<>f__anonymoustype03[system.string,system.string,system.string]]' type 'system.collections.generic.ilist`1[dataxlibrary.datax]'.

what doing wrong?

if want list < datax > need is:

ilist<datax> querylistfromftp = datax.getlistfromftp(filename).distinct().tolist(); // use querylistfromftp here. 

if want list of different type of object result of .select, need store result in list of object of type i.e. anonymous if that's want.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -