Skip to content

Commit

Permalink
checked Null another way
Browse files Browse the repository at this point in the history
  • Loading branch information
mossykazemi committed Oct 28, 2020
1 parent f5d879c commit 7d757ed
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions MoreExamples2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@ public static string Name

static void Main(string[] args)
{
Name = null;

//Name = null;

//if (Name == null)
// throw new ArgumentNullException(nameof(Name),"Name Must Not be null");

//Console.WriteLine(Name);


Console.WriteLine(Name);
Person p = new Person();
p.Name = "Mossy";
Console.WriteLine($"Name : {p?.Name}"); // check to see if it's null
}
}

class Person
{
public string Name { get; set; }

}
}

0 comments on commit 7d757ed

Please sign in to comment.