2 using System
.Runtime
.CompilerServices
;
8 public static void Main()
10 var x
= (C
<int>.E
)AttributeTest(typeof(C
<>.E
));
11 Assert(C
<int>.E
.V
== x
);
12 var y
= (C
<int>.E2
[])AttributeTest(typeof(C
<>.E2
));
13 Assert(y
.Length
== 2);
14 Assert(y
[0] == C
<int>.E2
.A
);
15 Assert(y
[1] == C
<int>.E2
.B
);
18 public static object AttributeTest (Type t
) {
19 var cas
= t
.GetCustomAttributes(false);
20 Assert(cas
.Length
== 1);
26 private static int AssertCount
= 0;
28 public static void Assert (
30 [CallerFilePath
] string sourceFile
= null,
31 [CallerLineNumber
] int lineNumber
= 0
36 Console
.Error
.WriteLine($"Assert failed at {sourceFile}:{lineNumber}");
37 Environment
.Exit(AssertCount
);
47 [A(X
= new [] { C<int>.E2.A, C<int>.E2.B }
)]
48 public enum E2 { A, B }