1 // string array initializer is allowed as a parameter type.
4 class FooAttribute
: Attribute
6 public string [] StringValues
;
7 public object [] ObjectValues
;
10 public FooAttribute ()
15 [Foo (StringValues
= new string [] {"foo", "bar", "baz"}
,
16 ObjectValues
= new object [] {1, 'A', "B"}
,
17 Types
= new Type
[] {typeof (int), typeof (Type)}
21 public static void Main ()
23 FooAttribute foo
= (FooAttribute
) typeof (Test
)
24 .GetCustomAttributes (false) [0];
25 if (foo
.StringValues
[0] != "foo"
26 || foo
.StringValues
[1] != "bar"
27 || foo
.StringValues
[2] != "baz"
28 || 1 != (int) foo
.ObjectValues
[0]
29 || 'A' != (char) foo
.ObjectValues
[1]
30 || "B" != (string) foo
.ObjectValues
[2]
31 || foo
.Types
[0] != typeof (int)
32 || foo
.Types
[1] != typeof (Type
)
34 throw new ApplicationException ();