I have created an attribute that accepts a (params) array in its constructor.
internal class MyTestAttribute : Attribute
{
public MyTestAttribute (params Options[] options)
{
....
}
}
Option
here is an enum (with lots of values), so a sample call site will be
[MyTest(Option.One, Option.Three)]
internal void SomeMethod(int param1, long param2)
{
....
}
Everything is peachy so far, and the setup works, but I'm receiving an "Arrays as attribute arguments is not CLS-compliant" warning on each call-site. Now, I have to admit that I do not need to use this assembly from anywhere other that C#, nor do I do warnings-as-errors, but the hundreds of warnings are getting annoying.
The obvious solution is to turn off CLS-compliance, but at the moment I can't do that.
Is there some other approach to the creation of the attribute that will still do the same thing, but get rid of the warnings?