Data Annotaion

The C# provides a data Annotation features. for example a date needs to be stored in the ddmmyy in database & while displaying you can display it in the format dd mm yyyy without any manual conversion & with some built in functions.
 
Here is the Model defined you can make you use of this in your project.

  public class Example
    {
        string _date = "50612";
        public string date
        {
            get
            {

                DateTime dt = DateTime.ParseExact(this._date, "ddMMyy", System.Globalization.CultureInfo.InvariantCulture);
                return dt.ToString("dd MMM yyyy");
            }
            set
            {
                DateTime dt = DateTime.ParseExact(value, "dd MMM yyyy", System.Globalization.CultureInfo.InvariantCulture);
                this._date = dt.ToString("ddMMyy");
            }
        }
    }