Implicit Conversion over a Collection

后端 未结 4 494
故里飘歌
故里飘歌 2021-01-02 02:22

I ran into a problem this week regarding implicit conversions in C# on collections. While this (using implicit) may not be our final approach, I wanted to at le

4条回答
  •  臣服心动
    2021-01-02 02:59

    The reason your examples don't work is because you are trying to assign an IEnumerable to a List. The following should work.

     List fooVos = foos.Select(x => x).ToList();
    

提交回复
热议问题