Skip to content

Commit

Permalink
Used (??) to throw exeption on Property
Browse files Browse the repository at this point in the history
  • Loading branch information
mossykazemi committed Oct 28, 2020
1 parent c52899d commit f5d879c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MoreExamples2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ 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)
{
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);
Expand Down

0 comments on commit f5d879c

Please sign in to comment.