using DTS.Common.SharedResource.Strings; using System; using System.ComponentModel; // ReSharper disable once CheckNamespace namespace DTS.Common.Attributes { /// /// this class overloads the description attribute to allow us to use an enum /// to set the description and to lookup the description in the string resources /// to be translated the property should have a string resource in the form of PropertyName_Description /// otherwise ##DescriptionNotFound## will be returned as the translated string /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Property)] [System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S3376:Attribute, EventArgs, and Exception type names should end with the type being extended", Justification = "extebded")] public class DescriptionAttributeEx : DescriptionAttribute { private readonly string _propertyIdString = null; public DescriptionAttributeEx(string propertyId) { _propertyIdString = propertyId; } public override string Description { get => StringResources.ResourceManager.GetString(_propertyIdString + "_Description") ?? @"##DescriptionNotFound##" + _propertyIdString; } } }