using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ParseTest
{
    class ParseTest
    {
        enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 };
        static void Main(string[] args)
        {
            Console.WriteLine("컬러 열거형에는 이런 값들이 있다 :");
            foreach (string s in Enum.GetNames(typeof(Colors)))
                Console.WriteLine(s);
            Console.WriteLine();
            Colors myOrange = (Colors)Enum.Parse(typeof(Colors), "Red, Yellow");
            Console.WriteLine("오랜지색 값은 합쳐진 것이다. {0}", myOrange);
        }
    }
}

Parse 메소드는 하나 이상의 열거된 상수의 이름이나 숫자 값의 문자열 표현을 해당하는 열거된 상수로 변환한다.

즉.. 숫자를 지정하지 않았으면 문자가 튀어 나온다.

이것 참 편리한 도구다.

다른 사이트도 있을듯 한데. ㅎㅎㅎ

http://hilite.me/


Posted by +깡통+