J
Jimmo
I have written a parameter attribute class
("AttributeTargets.Parameter). One of several the constructor
arguments is a parameter to specify a default value for the method's
parameter.
I would like to emulate InteropServices.DefaultParameterValueAttribute
behavior where at compile time, the specified default value is
validated against the method's data type and results in a compilation
failure if the validation fails. I don't see:
a. How I can gain access to the method's parameter info (specifically
datatype) to perform the validation.
b. How the resultant failed validation causes the compiler to fail
with error.
Any suggestions? I prefer not to have to call
DefaultParameterValueAttribute in addition to my attribute class?
Alternatively, is there a way to hijack the
DefaultParameterValueAttribute behavior in my class to achieve the
same result?
Thanks,
- Jim
("AttributeTargets.Parameter). One of several the constructor
arguments is a parameter to specify a default value for the method's
parameter.
I would like to emulate InteropServices.DefaultParameterValueAttribute
behavior where at compile time, the specified default value is
validated against the method's data type and results in a compilation
failure if the validation fails. I don't see:
a. How I can gain access to the method's parameter info (specifically
datatype) to perform the validation.
b. How the resultant failed validation causes the compiler to fail
with error.
Any suggestions? I prefer not to have to call
DefaultParameterValueAttribute in addition to my attribute class?
Alternatively, is there a way to hijack the
DefaultParameterValueAttribute behavior in my class to achieve the
same result?
Thanks,
- Jim