using System; using System.Linq; namespace DTS.Storage { #region CustomChannelFieldSizeExtensions public class CustomChannelFieldSizeAttribute : Attribute { internal CustomChannelFieldSizeAttribute(int size) { this.Size = size; } public int Size { get; private set; } } public static class CustomChannelFieldSizeExtensions { public static int GetFieldSize(MMETables.MMEPossibleChannelsFields field) { return (field.GetAttribute()).Size; } } public static class EnumExtensions { public static TAttribute GetAttribute(this Enum value) where TAttribute : Attribute { return (value.GetType()).GetField(Enum.GetName(value.GetType(), value)).GetCustomAttributes(false).OfType().SingleOrDefault(); } } #endregion CustomChannelFieldSizeExtensions }