我搜索,但沒有找到在C#鐵血陣列通過聲明數組
我已經宣佈和分配陣列的解決方案:
string[] arr1 = {"a","b","c","d","e","f"};
string[] arr2 = {"1","2","3","4","5","6"};
string[] arr3 = {"s","t","a","c","k","o"};
string[] arr4 = {"v","e","r","f","l","w"};
我要讓那些陣列交錯數組,但沒有成功。
string[,] port = new string[]
{
new string[] arr1[],
new string[] arr2[],
new string[] arr3[],
new string[] arr4[],
};
我犯的錯誤在哪裏?
我的計劃會產生隨機int
s到來自鋸齒狀排列調用值
Random random = new Random();
int x = random.Next(0,5);
int y = random.Next(0,3);
Console.WriteLine(port[y,x]);
你想創建一個數組的數組? – mm8
是的,但我做不到,它是一種2維數組,我怎麼需要從聲明的數組中創建該數組 – melic
簡而言之,[[,]'是多維的,[] []是鋸齒的 – Slai