我遇到了以下错误:
数组初始化器只能用于变量或字段初始化。尝试使用新表达式代替。
这是我的代码:
数组初始化器只能用于变量或字段初始化。尝试使用新表达式代替。
这是我的代码:
// Declare listbox information array
string [] tablet = new string[]{{"Microsoft Surface Price: $1,162.99 Screen Size: 10.6 Inches Storage Capacity: 128 GB"},
{"iPad 2 Price: $399.99, Screen Size: 9.7 Inches, Storage Capacity 16 GB"},
{"Samsung Galaxy Tab 2 Price: $329.99, Screen Size: 10.1 Inches, Storage Capacity 16 GB"},
{"NOOK HD Price: $199.99, Screen Size: 7 Inches, Storage Capacity 8 GB"},
{"IdeaTab Price: $149.99, Screen Size: 7 Inches, Storage Capacity: 8 GB"}};
//Array of product prices
int [] tabletPricesArray = new int[]{{"$1,162.99"},
{"$399.99"},
{"$329.99"},
{"$199.99"},
{"$149.99"}};
我不太确定出了什么问题。我对C#比较新手,如果需要任何额外的信息,请告诉我。