I want to store values as key,value,value pair. My data is of type
Key -> int & both values -> ulong,
How to initialize & fet
Create a Tuple class, in the System namespace:
public class Tuple
{
private readonly T1 _item1;
private readonly T2 _item2;
public Tuple(T1 item1, T2 item2)
{
this._item1 = item1;
this._item2 = item2;
}
public T1 Item1 { get { return _item1; } }
public T2 Item2 { get { return _item2; } }
}
And a static Tuple class with a Create method so you get type inference which is not available on constructors:
public static class Tuple
{
public static Tuple Create(T1 item1, T2 item2)
{
return new Tuple(item1, item2);
}
}
Then, when you get onto .NET 4.0, you can delete these classes because they're in the Base Class Library (and are compatible with F# tuples!).