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
|
// Declaring non-nullable variables and parameters
|
||||||
|
|
||||||
Address address = new();
|
Address address = new()
|
||||||
address.Building = null;
|
{
|
||||||
address.Street = null!; // null-forgiving operator
|
Building = null,
|
||||||
address.City = "London";
|
Street = null!, // null-forgiving operator
|
||||||
address.Region = "UK";
|
City = "London",
|
||||||
|
Region = "UK"
|
||||||
|
};
|
||||||
|
|
||||||
WriteLine(address.Building?.Length);
|
WriteLine(address.Building?.Length);
|
||||||
WriteLine(address.Street.Length);
|
WriteLine(address.Street.Length);
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,13 @@ WriteLine(thisCouldAlsoBeNull);
|
||||||
|
|
||||||
// Declaring non-nullable variables and parameters
|
// Declaring non-nullable variables and parameters
|
||||||
|
|
||||||
Address address = new();
|
Address address = new()
|
||||||
address.Building = null;
|
{
|
||||||
address.Street = null!; // null-forgiving operator
|
Building = null,
|
||||||
address.City = "London";
|
Street = null!, // null-forgiving operator
|
||||||
address.Region = "UK";
|
City = "London",
|
||||||
|
Region = "UK"
|
||||||
|
};
|
||||||
|
|
||||||
WriteLine(address.Building?.Length);
|
WriteLine(address.Building?.Length);
|
||||||
WriteLine(address.Street.Length);
|
WriteLine(address.Street.Length);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue