Enumeration string

Enumeration of members can be converted into a string.

But strings are not converted to enumeration

Only convert from a string enumeration members can be converted to an enumeration member from a string.

Enum into a string

  the Main void static (String [] args) 
        { 
            String = enum1.busy.ToString STR (); // Enumeration converted into a string variable member 
            enum1 state = (enum1) Enum.Parse ( typeof (enum1), str); / conversion / enumeration member and then converted into a string variable enumeration and stored in the state where 
            Console.WriteLine (state); 
            the Console.ReadKey (); 
        } 
        public enum Enum1 
        { 
            BUSY, 
            Online, 
            left, 
            Offline 
        }

Guess you like

Origin www.cnblogs.com/zhangyang4674/p/10605832.html