Ingen beskrivning
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CoordOptionsAttribute.cs 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. namespace XCharts.Runtime
  3. {
  4. [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
  5. public sealed class CoordOptionsAttribute : Attribute
  6. {
  7. public readonly Type type0;
  8. public readonly Type type1;
  9. public readonly Type type2;
  10. public readonly Type type3;
  11. public CoordOptionsAttribute(Type coord)
  12. {
  13. type0 = coord;
  14. }
  15. public CoordOptionsAttribute(Type coord, Type coord2)
  16. {
  17. type0 = coord;
  18. type1 = coord2;
  19. }
  20. public CoordOptionsAttribute(Type coord, Type coord2, Type coord3)
  21. {
  22. type0 = coord;
  23. type1 = coord2;
  24. type2 = coord3;
  25. }
  26. public CoordOptionsAttribute(Type coord, Type coord2, Type coord3, Type coord4)
  27. {
  28. type0 = coord;
  29. type1 = coord2;
  30. type2 = coord3;
  31. type3 = coord4;
  32. }
  33. public bool Contains<T>() where T : CoordSystem
  34. {
  35. var type = typeof(T);
  36. return (type == type0 || type == type1 || type == type2 || type == type3);
  37. }
  38. }
  39. }