/// <summary>
/// Determines whether an enum has been marked Obsolete.
/// </summary>
/// <param name="value">The enum value to check against.</param>
/// <returns>
///   <c>true</c> if marked obsolete; otherwise, <c>false</c>.
/// </returns>
public static bool IsEnumObsolete(this Enum value)
    var fi = value.GetType().GetField(value.ToString());
    var attributes = (ObsoleteAttribute[])fi.GetCustomAttributes(typeof(ObsoleteAttribute), false);
    return attributes.Length > 0;

Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume