Reputation: 14743
I'm utilizing generics as below:
public override ValidationResult SelfValidate()
{
return ValidationHelper.Validate<VendorValidator, Vendor>(this);
}
However, I can't seem to get the syntax quite right to allow me to pass in a different validator to override the VendorValidator type parameter. I would have expected to be able to use the Type datatype.
Upvotes: 0
Views: 72
Reputation: 28747
You should add a generic type parameter:
public override ValidationResult SelfValidate<T>()
{
return ValidationHelper.Validate<T, Vendor>(this);
}
You would use it like this:
this.selfValidate<VendorValidator>();
Note: I see that you're overriding a method. This will not work if you can't change the base method.
Upvotes: 1