mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
Initial commit
This commit is contained in:
parent
69eacee2fc
commit
b90eb4fd32
|
|
@ -19,11 +19,13 @@ WriteLine(thisCouldAlsoBeNull);
|
|||
|
||||
// Declaring non-nullable variables and parameters
|
||||
|
||||
Address address = new();
|
||||
address.Building = null;
|
||||
address.Street = null!; // null-forgiving operator
|
||||
address.City = "London";
|
||||
address.Region = "UK";
|
||||
Address address = new()
|
||||
{
|
||||
Building = null,
|
||||
Street = null!, // null-forgiving operator
|
||||
City = "London",
|
||||
Region = "UK"
|
||||
};
|
||||
|
||||
WriteLine(address.Building?.Length);
|
||||
WriteLine(address.Street.Length);
|
||||
|
|
|
|||
|
|
@ -19,11 +19,13 @@ WriteLine(thisCouldAlsoBeNull);
|
|||
|
||||
// Declaring non-nullable variables and parameters
|
||||
|
||||
Address address = new();
|
||||
address.Building = null;
|
||||
address.Street = null!; // null-forgiving operator
|
||||
address.City = "London";
|
||||
address.Region = "UK";
|
||||
Address address = new()
|
||||
{
|
||||
Building = null,
|
||||
Street = null!, // null-forgiving operator
|
||||
City = "London",
|
||||
Region = "UK"
|
||||
};
|
||||
|
||||
WriteLine(address.Building?.Length);
|
||||
WriteLine(address.Street.Length);
|
||||
|
|
|
|||
Loading…
Reference in a new issue