In mcs:
[mono.git] / mcs / tests / test-454.cs
1 // string array initializer is allowed as a parameter type.
2 using System;
3
4 class FooAttribute : Attribute
5 {
6         public string [] StringValues;
7         public object [] ObjectValues;
8         public Type [] Types;
9
10         public FooAttribute ()
11         {
12         }
13 }
14
15 [Foo (StringValues = new string [] {"foo", "bar", "baz"},
16         ObjectValues = new object [] {1, 'A', "B"},
17         Types = new Type [] {typeof (int), typeof (Type)}
18         )]
19 class Test
20 {
21         public static void Main () 
22         {
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)
33                         )
34                         throw new ApplicationException ();
35         }
36 }