I am searching a solution to get the complete String of an enum.
Example:
Public Enum Color { Red = 1, Blue = 2 } Color color = Color.Red; /
public static class Extensions { public static string GetFullName(this Enum myEnum) { return string.Format("{0}.{1}", myEnum.GetType().Name, myEnum.ToString()); } }
usage:
Color color = Color.Red; string fullName = color.GetFullName();
Note: I think GetType().Name is better that GetType().FullName
GetType().Name
GetType().FullName