Strongly typing the property in a comparison attribute

Topics: Wish List Forum
Developer
Dec 14, 2006 at 2:56 AM
I don't know if this is possible, but if it is I think it would be a great addition. In the attribute, instead of putting the 'compare to' property in as a string, enter it as a strongly typed item.
i.e.
NOW: ValidateDateOccursAfter("DateTime1", "DateTime2 must be after DateTime1.")
NEXT?: ValidateDateOccursAfter(this.DateTime1, "DateTime2 must be after DateTime1.")
Coordinator
Dec 18, 2006 at 5:31 AM
Unfortunately, I don't think this is possible. When you compile, this causes 2 errors:

- Keyword 'this' is not available in the current context
- An attribute argument must be a constant expression, typeof expression or array creation expression

So I agree it would be nice if we could do something like what you suggested, but no dice.