/Test/Resources/cs/CustomAttributes.cs
C# | 162 lines | 107 code | 38 blank | 17 comment | 0 complexity | b2a0e454dc765cb2c5e3da8d60c0a3bd MD5 | raw file
1using System; 2using System.Collections.Generic; 3using System.Runtime.CompilerServices; 4 5[assembly: Foo ("bingo")] 6 7[assembly: TypeForwardedTo (typeof (System.Diagnostics.DebuggableAttribute))] 8 9enum Bingo : short { 10 Fuel = 2, 11 Binga = 4, 12} 13 14/* 15in System.Security.AccessControl 16 17 [Flags] 18 public enum AceFlags : byte { 19 None = 0, 20 ObjectInherit = 0x01, 21 ContainerInherit = 0x02, 22 NoPropagateInherit = 0x04, 23 InheritOnly = 0x08, 24 InheritanceFlags = ObjectInherit | ContainerInherit | NoPropagateInherit | InheritOnly, 25 Inherited = 0x10, 26 SuccessfulAccess = 0x40, 27 FailedAccess = 0x80, 28 AuditFlags = SuccessfulAccess | FailedAccess, 29 } 30*/ 31 32class FooAttribute : Attribute { 33 34 internal class Token { 35 } 36 37 public FooAttribute () 38 { 39 } 40 41 public FooAttribute (string str) 42 { 43 } 44 45 public FooAttribute (sbyte a, byte b, bool c, bool d, ushort e, short f, char g) 46 { 47 } 48 49 public FooAttribute (int a, uint b, float c, long d, ulong e, double f) 50 { 51 } 52 53 public FooAttribute (char [] chars) 54 { 55 } 56 57 public FooAttribute (object a, object b) 58 { 59 } 60 61 public FooAttribute (Bingo bingo) 62 { 63 } 64 65 public FooAttribute (System.Security.AccessControl.AceFlags flags) 66 { 67 } 68 69 public FooAttribute (Type type) 70 { 71 } 72 73 public int Bang { get { return 0; } set {} } 74 public string Fiou { get { return "fiou"; } set {} } 75 76 public object Pan; 77 public string [] PanPan; 78 79 public Type Chose; 80} 81 82[Foo ("bar")] 83class Hamster { 84} 85 86[Foo ((string) null)] 87class Dentist { 88} 89 90[Foo (-12, 242, true, false, 4242, -1983, 'c')] 91class Steven { 92} 93 94[Foo (-100000, 200000, 12.12f, long.MaxValue, ulong.MaxValue, 64.646464)] 95class Seagull { 96} 97 98[Foo (new char [] { 'c', 'e', 'c', 'i', 'l' })] 99class Rifle { 100} 101 102[Foo ("2", 2)] 103class Worm { 104} 105 106[Foo (new object [] { "2", 2, 'c' }, new object [] { new object [] { 1, 2, 3}, null })] 107class Sheep { 108} 109 110[Foo (Bang = 42, PanPan = new string [] { "yo", "yo" }, Pan = new object [] { 1, "2", '3' }, Fiou = null)] 111class Angola { 112} 113 114[Foo (Pan = "fiouuu")] 115class BoxedStringField { 116} 117 118[Foo (Bingo.Fuel)] 119class Zero { 120} 121 122[Foo (System.Security.AccessControl.AceFlags.NoPropagateInherit)] 123class Ace { 124} 125 126[Foo (new object [] { Bingo.Fuel, Bingo.Binga }, null, Pan = System.Security.AccessControl.AceFlags.NoPropagateInherit)] 127class Bzzz { 128} 129 130[Foo (typeof (Bingo))] 131class Typed { 132} 133 134[Foo (typeof (FooAttribute.Token))] 135class NestedTyped { 136} 137 138[Foo (Chose = typeof (Typed))] 139class Truc { 140} 141 142[Foo (Chose = (Type) null)] 143class Machin { 144} 145 146[Foo (typeof (Dictionary<,>))] 147class OpenGeneric<X, Y> { 148} 149 150[Foo (typeof (Dictionary<string, OpenGeneric<Machin, int>[,]>))] 151class ClosedGeneric { 152} 153 154[Foo (typeof (Parent.Child[]))] 155class Parent { 156 public class Child { 157 } 158} 159 160[Foo ("Foo\0Bar\0")] 161class NullCharInString { 162}