C# C创建int和数组字典
如何创建包含int作为键和数组作为值的字典。以下是我在dotnetfiddle.net上尝试的内容,但运气不佳:C# C创建int和数组字典,c#,.net,dictionary,C#,.net,Dictionary,如何创建包含int作为键和数组作为值的字典。以下是我在dotnetfiddle.net上尝试的内容,但运气不佳: Dictionary<int, double[]> dict; double[] prices = new double[20]; dict = new Dictionary<int, prices>(); Dictionary<int, double[]> dict; dict = new Dictionary<int, new doub
Dictionary<int, double[]> dict;
double[] prices = new double[20];
dict = new Dictionary<int, prices>();
Dictionary<int, double[]> dict;
dict = new Dictionary<int, new double[20]>();
Dictionary<int, double[]> dict;
dict = new Dictionary<int, double[20]>();
你可以试试这个
Dictionary是泛型类型,您只能在其上设置合同类型
我认为您正在寻找Add方法来添加双数组
你可以试试这个
Dictionary是泛型类型,您只能在其上设置合同类型
我认为您正在寻找Add方法来添加双数组
Dictionary dict=新字典?Dictionary dict=新字典?
Dictionary<int, double[]> dict = new Dictionary<int, double[]>();
dict.Add(1,new double[20]);