如何将Multidimensional int Array转换为String List?

Ais*_*sac 0 .net c# arraylist type-conversion multidimensional-array

MultiDimensional 2D int数组到字符串List


我想转换我的array2D:

int[,] array2D = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } };
Run Code Online (Sandbox Code Playgroud)

到列表:

List<String> numbers = new List<string>(array2d.ToString());
Run Code Online (Sandbox Code Playgroud)

Tim*_*ter 5

你可以使用平面化多维数组 Enumerable.Cast

List<String> number = array2D.Cast<int>().Select(i => i.ToString()).ToList();
Run Code Online (Sandbox Code Playgroud)