I created an attribute that accepts an array (params) in its constructor.
internal class MyTestAttribute : Attribute
{
public MyTestAttribute (params Options[] options)
{
....
}
}
Option here is an enumeration (with many values), so an example of a request site would be
[MyTest(Option.One, Option.Three)]
internal void SomeMethod(int param1, long param2)
{
....
}
Everything is still smooth and the setup works, but I get a warning “Arrays as attributes is not CLS-compliant” on every client site. Now I have to admit that I do not need to use this assembly anywhere except C #, and I do not warn about errors, but hundreds of warnings become annoying.
The obvious solution is to disable CLS compliance, but at the moment I cannot do this.
Is there a different approach to creating an attribute that will still do the same thing, but get rid of the warnings?