i want to implement a sort function using a generic class.But when i declare the type generic parameter T it is not able to take the input from user.what should i do?
</code>
T q = Convert.ToInt32 (Console.ReadLi ne())
x[i] = Console.ReadLin e();
both lines are giving errors??
Code:
static void Sort<T>(ref T[] a)
{
T[] x;
Console.Write("how many numbers u want to sort:);
T q = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("enter the numbers you want to sort");
int i = 0;
for (i = 0; i < q; i++)
{
Console.Write(" ");
x[i] = Console.ReadLine();
}
Array.Sort(a);
Console.WriteLine(a);
T q = Convert.ToInt32 (Console.ReadLi ne())
x[i] = Console.ReadLin e();
both lines are giving errors??
Comment