public static void Main()
GetInput<string>("Enter name; ", ref sName);
GetInput<int>("Enter age: ", ref iAge);
DateTime DOB = default(DateTime);
GetInput<DateTime>("Enter DOB: ", ref DOB);
GetInput<string, int>("Enter module:", "Enter mark:", ref Module, ref mark);
Console.WriteLine("Good day, " + sName + ".");
Console.WriteLine("You were born on " + DOB.ToString() + ".");
Console.WriteLine("You are " + iAge.ToString() + " years old.");
Console.WriteLine("You got " + mark + " for " + Module + ".");
Console.Write("\nPress any key to exit ...");
private static void GetInput<T>(string prompt, ref T Input)
string sInput = Console.ReadLine();
Input = (T)Convert.ChangeType(sInput, typeof(T));
private static void GetInput<T1, T2>(string prompt1, string prompt2, ref T1 Input1, ref T2 Input2)
string sInput = Console.ReadLine();
Input1 = (T1)Convert.ChangeType(sInput, typeof(T1));
sInput = Console.ReadLine();
Input2 = (T2)Convert.ChangeType(sInput, typeof(T2));