어제 밤 나는 다음이 불가능하다는 꿈을 꾸었다. 그러나 같은 꿈에서 SO의 누군가가 다르게 말해주었습니다. 따라서 변환 System.Array이 가능한지 알고 싶습니다.List
Array ints = Array.CreateInstance(typeof(int), 5);
ints.SetValue(10, 0);
ints.SetValue(20, 1);
ints.SetValue(10, 2);
ints.SetValue(34, 3);
ints.SetValue(113, 4);
에
List<int> lst = ints.OfType<int>(); // not working
2
아래 링크는 C # codegateway.com/2011/12/…
당신은
—
Tim Schmelter
Array그것이 실제로 무엇인지 에 캐스팅해야 하며 int[], 다음을 사용할 수 있습니다 ToList:((int[])ints).ToList();