String representation of an Enum

后端 未结 30 1936
不思量自难忘°
不思量自难忘° 2020-11-22 02:44

I have the following enumeration:

public enum AuthenticationMethod
{
    FORMS = 1,
    WINDOWSAUTHENTICATION = 2,
    SINGLESIGNON = 3
}

T

30条回答
  •  抹茶落季
    2020-11-22 03:18

    based on the MSDN: http://msdn.microsoft.com/en-us/library/cc138362.aspx

    foreach (string str in Enum.GetNames(typeof(enumHeaderField)))
    {
        Debug.WriteLine(str);
    }
    

    str will be the names of the fields

提交回复
热议问题