From 9589cba28982651268f96bd3ec9d4fe3a9bac21f Mon Sep 17 00:00:00 2001 From: ewu-nma Date: Tue, 21 Jan 2025 16:41:21 +0100 Subject: [PATCH] move CsvExportArtikelArtExtension.GetDescription to EnumExtension.GetDescription --- .../Settings/MaterialbedarfExportSettingsDTO.cs | 11 ----------- .../Extensions/EnumExtension.cs | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 Gandalan.IDAS.WebApi.Client/Extensions/EnumExtension.cs diff --git a/Gandalan.IDAS.WebApi.Client/DTOs/Settings/MaterialbedarfExportSettingsDTO.cs b/Gandalan.IDAS.WebApi.Client/DTOs/Settings/MaterialbedarfExportSettingsDTO.cs index fb720086..848c8103 100644 --- a/Gandalan.IDAS.WebApi.Client/DTOs/Settings/MaterialbedarfExportSettingsDTO.cs +++ b/Gandalan.IDAS.WebApi.Client/DTOs/Settings/MaterialbedarfExportSettingsDTO.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using System.Reflection; using Gandalan.Client.Contracts.DataServices; namespace Gandalan.IDAS.WebApi.DTO; @@ -77,13 +76,3 @@ public enum ExportFarbArt Trendfarbe, Sonderfarbe, } - -public static class CsvExportArtikelArtExtension -{ - public static string GetDescription(this Enum value) - { - var field = value.GetType().GetField(value.ToString()); - var attribute = field.GetCustomAttribute(); - return attribute == null ? value.ToString() : attribute.Description; - } -} diff --git a/Gandalan.IDAS.WebApi.Client/Extensions/EnumExtension.cs b/Gandalan.IDAS.WebApi.Client/Extensions/EnumExtension.cs new file mode 100644 index 00000000..7477b6d2 --- /dev/null +++ b/Gandalan.IDAS.WebApi.Client/Extensions/EnumExtension.cs @@ -0,0 +1,15 @@ +using System.ComponentModel; +using System.Reflection; + +// ReSharper disable once CheckNamespace +namespace System; + +public static class EnumExtension +{ + public static string GetDescription(this Enum value) + { + var field = value.GetType().GetField(value.ToString()); + var attribute = field.GetCustomAttribute(); + return attribute == null ? value.ToString() : attribute.Description; + } +}