I am new with C# I got really stuck on this problem.
The task is to Write a C# program that implements bubble sort. The program gets the values as command-line arguments.
Here is my code:
namespace BubbleSort
{
class MySort
{
public void Main(int[] args)
{
int temp;
for (int j = 0; j <= args.Length - 2; j++)
{
for (int i = 0; i <= args.Length - 2; i++)
{
if (args[i] > args[i + 1])
{
temp = args[i + 1];
args[i + 1] = args[i];
args[i] = temp;
}
}
}
Console.WriteLine("Sorted:");
foreach (int p in args)
Console.Write(p + " ");
Console.Read();
}
}
}
And it always gives me error CS5001 Thank you in advance.