From a9721079f616020ae7dfb48d07a6a2ce7c64fe18 Mon Sep 17 00:00:00 2001 From: kalilistic <35899782+kalilistic@users.noreply.github.com> Date: Tue, 21 Feb 2023 22:53:54 -0500 Subject: [PATCH] feat: add ext method to check if enum is obsolete --- Dalamud/Utility/EnumExtensions.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Dalamud/Utility/EnumExtensions.cs b/Dalamud/Utility/EnumExtensions.cs index b4c58d95c..0bb60962e 100644 --- a/Dalamud/Utility/EnumExtensions.cs +++ b/Dalamud/Utility/EnumExtensions.cs @@ -27,4 +27,14 @@ public static class EnumExtensions .OfType() .SingleOrDefault(); } + + /// + /// Gets an indicator if enum has been flagged as obsolete (deprecated). + /// + /// The enum value that has an attached attribute. + /// Indicator if enum has been flagged as obsolete. + public static bool IsObsolete(this Enum value) + { + return GetAttribute(value) != null; + } }