Does anyone knows why I can't cast an Int
to an UInt
by using the Linq extension method Cast<>()
?
var myIntList = new List<int>();
myIntList.Add(1);
myIntList.Add(2);
myIntList.Add(3);
var myUIntList = myIntList.Cast<uint>().ToList();
It throws a Specified cast is not valid. When I'm using a Select()
, it will work (ofcourse).
var myIntList = new List<int>();
myIntList.Add(1);
myIntList.Add(2);
myIntList.Add(3);
var myUIntList = myIntList.Select(i => (uint)i).ToList();
(is it a bug or not implemented feature?)