mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat: add ext method to check if enum is obsolete
This commit is contained in:
parent
ca341ec3af
commit
a9721079f6
1 changed files with 10 additions and 0 deletions
|
|
@ -27,4 +27,14 @@ public static class EnumExtensions
|
|||
.OfType<TAttribute>()
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an indicator if enum has been flagged as obsolete (deprecated).
|
||||
/// </summary>
|
||||
/// <param name="value">The enum value that has an attached attribute.</param>
|
||||
/// <returns>Indicator if enum has been flagged as obsolete.</returns>
|
||||
public static bool IsObsolete(this Enum value)
|
||||
{
|
||||
return GetAttribute<ObsoleteAttribute>(value) != null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue