How to get the description of an enum in C#?

This simple code shows how to get the description of an enum in C#.

A sample enum could be-

public enum Colors{
[Description("Green but not so much!")]
Greenish,
[Description("Sky Blue")]
SkyBlue,
[Description("Blood Red")]
Blood Red
}

This below code gets the description of the enum-

public string GetEnumDescription(object val)
{
return
val.GetType()
.GetMember(val.ToString())
.FirstOrDefault()?.GetCustomAttribute<DescriptionAttribute>(false)?.Description ??
(val.ToString() == "0" ? "" : val.ToString());
}