0

Hello ppl... Can someone show me how to make a method with "unknown" data type ?

I want to create one function for sorting array with different data type...

(I know for .NET library but I want to create custom library...)

For example:

```
public class Sort
{
// THis function is only for int[] data type
// I want this function to be for all (numerics) data types
private static int[] bySmellest(int[] Arr)
{
for (int i = 0; i < Arr.Length; i++)
{
for (int j = 0; j < Arr.Length; j++)
{
if (Arr[j] < Arr[j - 1])
{
int tmp = Arr[j];
Arr[j] = Arr[j - 1];
Arr[j - 1] = Arr[j];
}
}
}
return Arr;
}
// Error - byte[] != int
public static byte[] BySmallest(byte[] Arr)
{
return bySmellest(Arr);
}
// Error - short[] != int
public static short[] BySmallest(short[] Arr)
{
return bySmellest(Arr);
}
// True - int[] = int[]
public static int[] BySmallest(int[] Arr)
{
return bySmellest(Arr);
}
}
```

Thanks...