please help me to sort the string array in bubble sort method.
Please help me sort [without using Collectons or Array.Sort()] the string array in the following code snippet:
using System;
class MainClass
{
static void Main()
{
string[] s = {"Bill", "Gates", "James", "Apple", "Net", "Java"};
try
{
for(int i=0; i<s.Length; i++)
{
for(int j=0; j<s.Length-1; j++)
{
for(int k=0; k<s.Length; k++)
if(s[j][k] > s[j+1][k])
{
string temp = s[j];
s[j] = s[j+1];
s[j+1] = temp;
}
}
}
}
catch(Exception)
{
}
for(int i=0; i<s.Length; i++ )
{
Console.WriteLine(s + " ");
}
}
}
the above code throwing error please help me to sort string array.