how to initialize dictionary as (key,value,value) pair in C#
.net, c#, dictionary
Solution
Create a structure to store your values:
struct ValuePair
{
public ulong Value1;
public ulong Value2;
}
Dictionary initialization:
Dictionary<int, ValuePair> dictionary = new Dictionary<int, ValuePair>();
Maybe List is enough, if you use int as key?
List:
List<ValuePair> list = new List<ValuePair>();
`ValuePair` can be added to the `list` as following:
list.Add(new ValuePair { Value1 = 1, Value2 = 2 });
Problem
I want to store values as key,value,value pair. My data is of type ``` Key -> int & both values -> ulong, ``` How to initialize & fetch values of such dictionary. I am using VS-2005. If i use a class or struct then how do i fetch the values.