-2 c# string collections
我正在尝试将Elements添加到以下内容中.它不起作用.我该怎么做 ?
List<String[,]> S = new List<String[,]>();
Run Code Online (Sandbox Code Playgroud)
告诉你为什么我要尝试这样的事情; 我最初需要以下::
String[,] s = new String[60,2] ;
s[0,0] = ".NET CLR LocksAndThreads";
s[0,1] = "Contention Rate / sec";
s[1,0] = "ASP.NET Applications";
s[1,1] = "Requests Rejected";
s[2,0] = "Memory";
s[2,1] = "Available Mbytes";
s[3,0] = "Process";
s[3,1] = "Private Bytes";
s[4,0] = "Network Interface";
s[4,1] = "Bytes Received/sec";
Run Code Online (Sandbox Code Playgroud)
但后来我想为什么不使用List.所以请告诉我我做错了什么..
您似乎想要将2D字符串数组转换为对您的给定数据更有意义的数组.
查看2D数组中的这些值,并基于它是一个X by 2数组的事实,使用字典可能更有意义:
Dictionary<string, string> S = new Dictionary<string, string>
{
{ ".NET CLR LocksAndThreads", "Contention Rate / sec" },
{ "ASP.NET Applications", "Requests Rejected" },
{ "Memory", "Available Mbytes" },
{ "Process", "Private Bytes" },
{ "Network Interface", "Bytes Received/sec" }
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
523 次 |
| 最近记录: |