.NET 4.0 New Feature - Tuple
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var var1 = Tuple.Create(1, 2, 1);
var var2 = Tuple.Create(1, 1, 2);
Console.WriteLine("Var1 : {0}", var1);
Console.WriteLine("Var2 : {0}", var2);
Console.WriteLine("Var1 == Var2 : {0}", var1 == var2);
Console.WriteLine("Var1.Equals(Var2) : {0}", var1.Equals(var2));
Console.WriteLine("(Var1 as IComparable).CompareTo(Var2) : {0}", (var1 as IComparable).CompareTo(var2));
Console.WriteLine();
Console.WriteLine("Original Array...");
var tupeArray = new Tuple<int, int, int>[] { var1, var2 };
foreach (var item in tupeArray)
Console.WriteLine(item);
Console.WriteLine();
Console.WriteLine("Sorted Array...");
Array.Sort(tupeArray);
foreach (var item in tupeArray)
Console.WriteLine(item);
}
}
}