/ICSharpCode.Decompiler/Tests/CustomAttributes.code.cs

http://github.com/icsharpcode/ILSpy · C# · 41 lines · 41 code · 0 blank · 0 comment · 0 complexity · 2362ff3c385a80a8389e0f0cdc96847e MD5 · raw file

  1. using System;
  2. namespace aa
  3. {
  4. public static class CustomAtributes
  5. {
  6. [Flags]
  7. public enum EnumWithFlag
  8. {
  9. All = 15,
  10. None = 0,
  11. Item1 = 1,
  12. Item2 = 2,
  13. Item3 = 4,
  14. Item4 = 8
  15. }
  16. [AttributeUsage(AttributeTargets.All)]
  17. public class MyAttribute : Attribute
  18. {
  19. public MyAttribute(CustomAtributes.EnumWithFlag en)
  20. {
  21. }
  22. }
  23. [CustomAtributes.MyAttribute(CustomAtributes.EnumWithFlag.Item1 | CustomAtributes.EnumWithFlag.Item2)]
  24. private static int field;
  25. [CustomAtributes.MyAttribute(CustomAtributes.EnumWithFlag.All)]
  26. public static string Property
  27. {
  28. get
  29. {
  30. return "aa";
  31. }
  32. }
  33. [Obsolete("some message")]
  34. public static void ObsoletedMethod()
  35. {
  36. Console.WriteLine("{0} $$$ {1}", AttributeTargets.Interface, AttributeTargets.Property | AttributeTargets.Field);
  37. AttributeTargets attributeTargets = AttributeTargets.Property | AttributeTargets.Field;
  38. Console.WriteLine("{0} $$$ {1}", AttributeTargets.Interface, attributeTargets);
  39. }
  40. }
  41. }