You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2021-08-02-LetsRefactorATest.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -190,7 +190,7 @@ If we have more than one test without a timezone, we can use a constant `NoTimeZ
190
190
191
191
For our last refactor, let's remove those `Verify()` calls. We don't need them. [We don't need to assert on stubs]({% post_url 2021-06-07-TipsForBetterStubsAndMocks %}).
192
192
193
-
If any of the stubs weren't in place, probably we will get a `NullReferenceException` somewhere in our code. Those extra verifications make our test harder to maintain.
193
+
If any of the stubs weren't in place, probably we will get a [NullReferenceException]({% post_url 2023-02-20-WhatNullReferenceExceptionIs %}) somewhere in our code. Those extra verifications make our test harder to maintain.
Copy file name to clipboardExpand all lines: _posts/2021-09-13-TopNewCSharpFeatures.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -43,9 +43,9 @@ Now, it's clearer if we're missing a parameter or if we have them in the wrong o
43
43
44
44
### Null-conditional (?.) and null-coalescing operators (??)
45
45
46
-
Starting from C# 6.0, we have two new operators: null-conditional `?.` and null-coalescing `??` operators. These two new operators helps us to get rid of null values and `NullReferenceException`.
46
+
Starting from C# 6.0, we have two new operators: null-conditional `?.` and null-coalescing `??` operators. These two new operators helps us to get rid of null values and [NullReferenceException]({% post_url 2023-02-20-WhatNullReferenceExceptionIs %}).
47
47
48
-
With the null-conditional `?.` operator, we access a member's object if the object isn't null. Otherwise, it returns null.
48
+
With the null-conditional `?.` operator, we access a member's object if the object isn't null. Otherwise, it returns `null`.
49
49
50
50
The null-coalescing `??` operator evaluates an alternative expression if the first one is null.
51
51
@@ -70,7 +70,7 @@ string name = ReadNameFromSomewhere();
70
70
name?.Trim() ??"none";
71
71
```
72
72
73
-
It executes `Trim()` only if `name` isn't null. Otherwise, `name?.Trim()` returns `null`. But, with the `??` operator, the whole expression returns "none".
73
+
It executes `Trim()` only if `name` isn't `null`. Otherwise, `name?.Trim()` returns `null`. But, with the `??` operator, the whole expression returns "none".
74
74
75
75
### Expression body definition (=>)
76
76
@@ -510,7 +510,7 @@ if (canBeNullName != null)
510
510
511
511
### Records
512
512
513
-
A record is an immutable reference type with built-in equality methods. When we create a record, the compiler creates `ToString`, `GetHashCode`, value-based equality methods, a copy constructor and a deconstructor.
513
+
A record is an immutable reference type with built-in equality methods. When we create a record, the compiler creates `ToString()`, `GetHashCode()`, value-based equality methods, a copy constructor and a deconstructor.
514
514
515
515
Records are helpful to replace value-objects in our code.
0 commit comments