I want to do a dictionary which contains another dictionary. And I want that my dictionary have multiple values for only one key but I get a error : "An element with the same key already exists". I already did it in JAVA with HashMap and it's ok but in C# ...
Something like this:
static Dictionary<int, Dictionary<double, double>> _dict = new Dictionary<int, Dictionary<double, double>>()
{
{ 1, new Dictionary<double,double>{ { 0.990, 0.0316 } } },
{ 1, new Dictionary<double,double>{ { 0.975, 0.0398 } } },
{ 1, new Dictionary<double,double>{ { 0.950, 0.0239 } } },
{ 1, new Dictionary<double,double>{ { 0.9 , 0.0158 } } },
{ 1, new Dictionary<double,double>{ { 0.1 , 2.71 } } },
{ 1, new Dictionary<double,double>{ { 0.050, 3.84 } } },
{ 1, new Dictionary<double,double>{ { 0.025, 5.02 } } },
{ 1, new Dictionary<double,double>{ { 0.010, 6.63 } } },
{ 2, new Dictionary<double,double>{ { 0.990, 0.02 } } },
{ 2, new Dictionary<double,double>{ { 0.975, 0.05 } } },
{ 2, new Dictionary<double,double>{ { 0.950, 0.10 } } },
{ 2, new Dictionary<double,double>{ { 0.9 , 0.21 } } },
{ 2, new Dictionary<double,double>{ { 0.1 , 4.60 } } },
{ 2, new Dictionary<double,double>{ { 0.050, 5.99 } } },
{ 2, new Dictionary<double,double>{ { 0.025, 7.38 } } },
{ 2, new Dictionary<double,double>{ { 0.010, 9.21 } } },
{ 3, new Dictionary<double,double>{ { 0.990, 0.12 } } },
{ 3, new Dictionary<double,double>{ { 0.975, 0.22 } } },
{ 3, new Dictionary<double,double>{ { 0.950, 0.35 } } },
{ 3, new Dictionary<double,double>{ { 0.9 , 0.58 } } },
{ 3, new Dictionary<double,double>{ { 0.1 , 6.25 } } },
{ 3, new Dictionary<double,double>{ { 0.050, 7.81 } } },
{ 3, new Dictionary<double,double>{ { 0.025, 9.35 } } },
{ 3, new Dictionary<double,double>{ { 0.010, 11.34 } } },
};
I try the solution of LordTakkera.
I do that because I have to represent KHI2 Table. I do this in JAVA and my soft works perfectly but I don't know how to use REF in .NET.