- What types are legal to use for the public nonstatic fields and properties?
- How to apply attribute correctly?
To implement public members of an attribute class we can use nonstatic properties and fields only. The legal set of data types is limited to the following:
Boolean, Char, Byte, SByte UInt16, Int16, UInt32, Int32, UInt64, Int64, Single, Double, String, Object, Type. It’s also possible to pass single dimension zero based arrays, but isn’t CLS-compliant way.
When applying attribute, we must pass a compile-time constant expressions that matches the type defined by the attribute class.