.NET Fiddle

CSharp · Console

/Program.cs

using System;
					using System.Collections.Generic;
public class Program
{

	
	static void BubbleSort(int[] list) 

            {

                for (int i = 0; i < list.Length - 1; i++)
                {

                    for (int j = 0; j < list.Length - 1 - i; j++)
                    {
                        if (list[j].CompareTo(list[j + 1]) > 0)
                        {
                            int tmp = list[j + 1];
                            list[j + 1] = list[j];
                            list[j] = tmp; 
                        }
                    }

                }
            }

    // Start is called before the first frame update
    static void Main()
    {
		var x = new int[]{1,9,4,8,2,5};
		BubbleSort(x);
		
		Console.WriteLine(string.Join(",", x));
    }
}
;