[Mono-list] Attribute problem with mcs

Gonzalo Paniagua Javier gonzalo@ximian.com
05 Sep 2002 04:12:41 +0200


El jue, 05-09-2002 a las 04:10, kojo escribió:
> using System.Xml.Serialization;
>     public class SerializableClass
>     { 
>         [XmlAttribute( Type=typeof(MyEntry) )]
>         public Entry myEntry;
>     }
> 
>     public class Entry{}
>     public class MyEntry : Entry{}
> 
> It fails with the error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression.

I'll fill a bug report (if there's no other about it).

By now, you can use: [XmlAttribute(typeof(MyEntry))], which works with
both compilers.

-Gonzalo