What's the most elegant way to bubble-sort in C#?

后端 未结 10 1869
旧巷少年郎
旧巷少年郎 2020-12-06 03:33

Can this be cleaned up?

using System;  
class AscendingBubbleSort 
{     
    public static void Main()
    {
        int i = 0,j = 0,t = 0;
        int []c=         


        
10条回答
  •  旧巷少年郎
    2020-12-06 03:59

    I personally prefer this:

    string foo [] = new string[] {"abc", "def", "aaa", "feaf", "afea" };
    Array.Sort(foo);
    

    But that's just me. Sort is a solved problem, why reinvent the wheel?

提交回复
热议问题