Check out example codes for "c# properties making string required". It will help you in understanding the concepts better.

Code Example 1

using System.ComponentModel.DataAnnotations;

{
  [Required(ErrorMessage = "DocumentType is required.")]
  public string DocumentType 
  { 
      get { return _documentType; }
      set { _documentType = value; }
  }
}

Learn ReactJs, React Native from akashmittal.com