【转】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));
        }

    }

}
posted @ 2009-08-21 18:09  景天  阅读(2204)  评论(1编辑  收藏  举报