1 Replies - 688 Views - Last Post: 21 February 2015 - 02:17 AM Rate Topic: -----

#1 daqs   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 20-February 15

Cast Nested List<X> to Nested List<Y>

Posted 20 February 2015 - 11:15 PM

I know its possible to cast a list of items from one type to another but how do you cast a nested list to nested List?

Already tried solutions:

List<List<String>> new_list = new List<List<string>>(abc.Cast<List<String>>());

and
List<List<String>> new_list = abc.Cast<List<String>>().ToList();

Both of which give the following error:

Quote

Unable to cast object of type 'System.Collections.Generic.List1[System.Int32]' to type
'System.Collections.Generic.List1[System.String]'.


Is This A Good Question/Topic? 0
  • +

Replies To: Cast Nested List<X> to Nested List<Y>

#2 andrewsw   User is offline

  • RequestedRangeNotSatisfiable
  • member icon

Reputation: 6561
  • View blog
  • Posts: 26,600
  • Joined: 12-December 12

Re: Cast Nested List<X> to Nested List<Y>

Posted 21 February 2015 - 02:17 AM

Answered here at SO
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1