How to validate string not to be null?

By aj li

I had a customer name field which is a required field. Name should not be null.

[NotNullValidator(MessageTemplate="Required Field")]
        public CustomerData Customer
        {
            get
            {
                return CustomerField;
            }
            set
            {
                if (object.ReferenceEquals(CustomerField, value) != true)
                {
                    CustomerField = value;
                     NotifyPropertyChanged("Customer");
                 }
             }
        }

How to validate string not to be null?  (648 Views)