jeudi 11 mai 2017

Defining general attribute in c#

I want to have a simple attribute which returns Uppercase of any class field

public class Person{
   [Upper(true)]
  public string Name {get;set;}
}
public class Employee{
   [Upper(true)]
  public string departmentName {get;set;}
}

In almost any articles that I found, Upper method is implemented in class Person. However, I want to have a general attribute to have it on different classes.





Aucun commentaire:

Enregistrer un commentaire