CODEKILLER

반응형

Array.Sort
Array.Sort

public class Example
{
    public static void Main()
    {
        string[] lines = new string[]
        {
            @"textfile.txt",
            @"textFile.TXT",
            @"Text.txt",
            @"testfile2.txt"
        };

        Console.WriteLine("Non-sorted 상태 :");
        foreach (string s in lines)
        {
            Console.WriteLine($"   {s}");
        }

        Console.WriteLine("\n\rSorted 상태:");

        Array.Sort(lines, StringComparer.CurrentCulture);

        foreach (string s in lines)
        {
            Console.WriteLine($"   {s}");
        }
    }
}
반응형

공유하기

facebook twitter kakaoTalk kakaostory naver band