C#中文排序(拼音和笔画)

using System;

using System.Globalization;

using System.Threading;



namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

        {



            string[] arr = { "3","1","2","b","c","a","BB","A","C","阿尔巴尼亚", "一刀切", "二刀切" , "三刀切"};

            //发音 LCID:0x00000804

            CultureInfo PronoCi = new CultureInfo(2052);



            Array.Sort(arr);



            Console.WriteLine("按发音排序:");

            for (int i = arr.GetLowerBound(0); i <= arr.GetUpperBound(0); i++)

                Console.WriteLine("[{0}]:\t{1}", i, arr.GetValue(i));



            Console.WriteLine();

            //笔画数 LCID:0x00020804

            CultureInfo StrokCi = new CultureInfo(133124);



            Thread.CurrentThread.CurrentCulture = StrokCi;



            Array.Sort(arr);



            Console.WriteLine("按笔划数排序:");

            for (int i = arr.GetLowerBound(0); i <= arr.GetUpperBound(0); i++)

                Console.WriteLine("[{0}]:\t{1}", i, arr.GetValue(i));

        }



    }



}

你可能感兴趣的:(C#)