init
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
|
||||
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<CustomChannelFieldSizeAttribute>()).Size;
|
||||
}
|
||||
|
||||
}
|
||||
public static class EnumExtensions
|
||||
{
|
||||
public static TAttribute GetAttribute<TAttribute>(this Enum value)
|
||||
where TAttribute : Attribute
|
||||
{
|
||||
return (value.GetType()).GetField(Enum.GetName(value.GetType(), value)).GetCustomAttributes(false).OfType<TAttribute>().SingleOrDefault();
|
||||
}
|
||||
}
|
||||
#endregion CustomChannelFieldSizeExtensions
|
||||
}
|
||||
Reference in New Issue
Block a user