I need to mark some properties as passwords so that they could be automatically screened. I found a standard attribute for that:
[PasswordPropertyText]
public string ThePassword { get; set; }
Following method checks if the attribute is there:
private static bool _isPassword(PropertyInfo p)
{
PasswordPropertyTextAttribute passProp = (PasswordPropertyTextAttribute)p.GetCustomAttribute(typeof(PasswordPropertyTextAttribute));
return (passProp != null); // Additional condition should go here
}
Now I would like to have my own logic here:
- [PasswordPropertyText] should result in true.
- [PasswordPropertyText(true)] should result in true.
- [PasswordPropertyText(false)] should result in false.
but the default value of PasswordPropertyTextAttribute.Password
is false when the argument is omitted.
Is there any way to get the raw attribute value?
Aucun commentaire:
Enregistrer un commentaire