CODEKILLER

반응형

> IEnumerable<T> 형식을 반환.

Enumerable.Cast 메서드
Enumerable.Cast 메서드

public class Example
{
    public static void Main()
    {
        Console.Write("<< Enumerable.Cast 출력 예제 >> \n");

        System.Collections.ArrayList codes = new System.Collections.ArrayList();
        codes.Add("codeA");
        codes.Add("codeB");
        codes.Add("codeC");

        IEnumerable<string> query = codes.Cast<string>().OrderBy(code => code).Select(code => code);

        foreach (string code in query)
        {
            Console.WriteLine(code);
        }

        Console.WriteLine(System.Environment.NewLine);
        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
    }
}
반응형

공유하기

facebook twitter kakaoTalk kakaostory naver band