Advertisement
vvsvvs

Untitled

Jul 5th, 2022
873
140 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.41 KB | None
  1. public string Name
  2.         {
  3.             get => this.name;
  4.             private set
  5.             {
  6.                 string[] whiteSpace = value.Split(' ', StringSplitOptions.RemoveEmptyEntries);
  7.  
  8.                 bool isNameCoprect = ((value != string.Empty) && (value != null) && (whiteSpace.Length > 0));
  9.  
  10.                 if (isNameCoprect)
  11.                 {
  12.                     this.name = value;
  13.                 }
  14.                 else
  15.                 {
  16.                     throw new ArgumentException("A name should not be empty.");
  17.                 }
  18.             }
  19.         }
Advertisement
RAW Paste Data Copied
Advertisement