Cast Object to Generic List

后端 未结 8 1301
野趣味
野趣味 2020-12-03 03:37

I have 3 generict type list.

List = new List();
List
= new List
(); List = new Lis
8条回答
  •  清歌不尽
    2020-12-03 04:03

    Lots of trial and error gave me this on SL 5 but it should also work on a regular C#. You also need to add LINQ to your using list for the last half to work.

        List myAnythingList = (value as IEnumerable).Cast().ToList()
    
    
    

    Enjoy!

    提交回复
    热议问题