1. 1.Reusable
for mutiple data types.
2. 2.Reduces
coding lines.
GenericTupleOfTwo<string, int>
generic1=new GenericTupleOfTwo<string, int>();
GenericTupleOfTwo<string, DateTime>
generic2 = new GenericTupleOfTwo<string, DateTime>();
GenericTupleOfTwo<double, DateTime>
generic3 = new GenericTupleOfTwo<double, DateTime>();
/// <summary>
/// Helps to create generic class
/// </summary>
public class GenericTupleOfTwo<T1,
T2>
{
private T1 first;
private T2 second;
public T1 First
{
get { return first; }
set { first = value; }
}
public T2 Second
{
get { return second; }
set { second = value; }
}
public GenericTupleOfTwo()
{
}
public GenericTupleOfTwo(T1
first, T2 second)
{
this.First = first;
this.Second = second;
}
}
Thanks for reading this article. Have a nice day.