C#: ENUMTOTYPE / TYPETOENUM

Author
Paulo Almeida
Description
Convert (Enum to Type and Type to Enum)
Visits
219
Share
Digg Del.icio.us Reddit Simpy StumbleUpon Furl Yahoo Spurl Google Blinklist Blinkbits Ma.Gnolia Technorati Newsvine Netvouz Slashdot Netscape
namespace test
{
	public enum Fields
        {
            StampDateTime,
            Type,
            Scope,
            Host,
            UserID,
            EntityRelated,
            ObjectRelated,
            Message
        }
 
	private void btnEnum_Click(object sender, EventArgs e)
        {
            int value = Integra.iEntities.IntLog.Fields.Message.GetHashCode();   //  Return ==> 7
            Fields dow = (Fields)Enum.ToObject(typeof(Fields), value);           //  Return ==> Message
    	}
}