MessageHandlerAttribute.cs 402 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Collections.Generic;
  3. namespace Model
  4. {
  5. /// <summary>
  6. /// 搭配MessageComponent用来分发消息
  7. /// </summary>
  8. public class MessageHandlerAttribute : Attribute
  9. {
  10. private readonly AppType type;
  11. public MessageHandlerAttribute(AppType appType)
  12. {
  13. this.type = appType;
  14. }
  15. public bool Contains(AppType appType)
  16. {
  17. return this.type.Is(appType);
  18. }
  19. }
  20. }