UniqueIdAttribute.cs 584 B

123456789101112131415161718192021222324
  1. using System;
  2. namespace ET
  3. {
  4. /// <summary>
  5. /// 唯一Id标签
  6. /// 使用此标签标记的类 会检测类内部的 const int 字段成员是否唯一
  7. /// 可以指定唯一Id的最小值 最大值区间
  8. /// </summary>
  9. [AttributeUsage(AttributeTargets.Class, Inherited = false)]
  10. public class UniqueIdAttribute : Attribute
  11. {
  12. public int Min;
  13. public int Max;
  14. public UniqueIdAttribute(int min = int.MinValue, int max = int.MaxValue)
  15. {
  16. this.Min = min;
  17. this.Max = max;
  18. }
  19. }
  20. }