I am attempting to pass objects into an Attributes constructor as follows:
[PropertyValidation(new NullOrEmptyValidatorScheme())]
public string Name { get; private set; }
With this attribute constructor:
public PropertyValidationAttribute(IValidatorScheme validator) {
this._ValidatorScheme = validator;
}
The code won't compile. How can I pass an object into an attribute as above?
EDIT: Yes NullOrEmptyValidatorScheme implements IValidatorScheme.
The error: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type.