how to convert List to List in c# windows phone 8 app?
obj_1
and obj_2
are lists. I have Following code:
List<obj_1> list = new List<obj_1>();
obj_1 = new List<obj_1>(obj_2.Of Type<obj_1>().To List());
OR
List<obj_1> list = new List<obj_1>();
obj_1 = new List<obj_1>(obj_2.Cast<obj_1>().To List());
while debugging the code, count in obj_1 is 0 and obj_2 is 10.Please suggest any solution.Thank You
To convert from List<> of type obj1 to List<> of type obj2 then List<T>.ConvertAll
List<obj2> resultList= List<obj1>.ConvertAll(x => new Obj2 { Property = x.SomeValue });
or
List<obj_2> resultList = new List<obj_2>(List<obj_1>.Cast<obj_1>());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.