Interrogating Properties
If I have a class with properties like the following:
[ValidateNotEmpty, ValidateLength(100)]
public string LastName
{
get { return this._lastName; }
set { this._lastName = value; }
}
How could I set up these properties so they could be interrogated for values in their attributes? Ideally:
user.LastName.MaxLength
would return 100. The ValidateLength attribute has a max length property I can talk to and I have a workaround method that requires me to pass the property name back to the object to get the number, but I'd like the syntactic sugar of user.LastName.MaxLength if possible. I'm not sure how to add to a property though.
|