diff --git a/MoreExamples2/Program.cs b/MoreExamples2/Program.cs index c37c85c..91072bc 100644 --- a/MoreExamples2/Program.cs +++ b/MoreExamples2/Program.cs @@ -12,7 +12,7 @@ class Program public static string Name { get => _name; - set => _name = value; + set => _name = value ?? throw new ArgumentNullException("Name", "Namw is Null"); } static void Main(string[] args) @@ -20,8 +20,8 @@ static void Main(string[] args) Name = null; - if (Name == null) - throw new ArgumentNullException(nameof(Name),"Name Must Not be null"); + //if (Name == null) + // throw new ArgumentNullException(nameof(Name),"Name Must Not be null"); Console.WriteLine(Name);