Bugzilla – Bug 318877
[PATCH] allow string array for attribute parameter type
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by atsushi@ximian.com 2005-09-02 10:52:12 MST ---- Currently mcs does not allow string array type as a parameter type, while it is allowed: <blockquote> 24.1.3 Attribute parameter types The types of positional and named parameters for an attribute class are limited to the attribute parameter types, which are: • One of the following types: bool, byte, char, double, float, int, long, short, string. • The type object. • The type System.Type. • An enum type, provided it has public accessibility and the types in which it is nested (if any) also have public accessibility. • Single-dimensional arrays of the above types. </blockquote> ---- repro ---- using System; class FooAttribute : Attribute { public string [] Values; public FooAttribute () { } } [Foo (Values = new string [] {"foo", "bar", "baz"})] class Test { public static void Main () {} } -------- Actual Results: test-453.cs(13,2): error CS0655: `Values' is not a valid named attribute argument because it is not a valid attribute parameter type. Expected Results: Compiles successfully. Attaching a fix. ---- Additional Comments From atsushi@ximian.com 2005-09-02 10:52:38 MST ---- Created an attachment (id=168455) proposed fix ---- Additional Comments From rharinath@novell.com 2005-09-02 14:50:49 MST ---- Looks good. Please apply. ---- Additional Comments From atsushi@ximian.com 2005-09-05 02:13:12 MST ---- Created an attachment (id=168456) improved patch. Type[] and Object[] should be treated as well. ---- Additional Comments From atsushi@ximian.com 2005-09-05 13:54:03 MST ---- Fixed in svn (r49488). Imported an attachment (id=168455) Imported an attachment (id=168456) Unknown operating system unknown. Setting to default OS "Other".