Witam serdecznie, mam problem co zrobić aby dane w tablicy były sortowane za pomocną metody sort? ( Cały czas wyskakuje problem z typem danych generycznych i konwersacja na int)```
```using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace dd
{
class Program
{
private static int j, i;
private static List<int> x;
static void Sort<T>(List<int> tablica, params int[] tab)
{
for (int i = 1; i < tab.Length; i++)
{
for (j = tab.Length - 1; j >= i; j--)
{
if (tab[j - 1] > tab[j])
{
int temp = tab[j];
tab[j] = tab[j - 1];
tab[j - 1] = temp;
}
}
}
}
static void Main(string[] args)
{
List<int> tablica = new List<int>();
Random r = new Random();
for (int i = 0; i < 10; i++)
{
tablica.Add(r.Next(1, 1000));
Console.WriteLine();
}
for (int i = 0; i < 10; i++)
{
tablica[i] = Sort();
Console.WriteLine(tablica[i] + " ");
}
}
}
}
params
, więc ją posortuje... ale co z tego? ;)