We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c0f1c2 commit 051bf43Copy full SHA for 051bf43
csharp/NullableIntroduction/NullableIntroduction/SurveyResponse.cs
@@ -14,7 +14,7 @@ public class SurveyResponse
14
15
// <SnippetSurveyStatus>
16
public bool AnsweredSurvey => surveyResponses != null;
17
- public string Answer(int index) => surveyResponses.GetValueOrDefault(index, "No answer")!;
+ public string Answer(int index) => surveyResponses?.GetValueOrDefault(index) ?? "No answer";
18
// </SnippetSurveyStatus>
19
20
public SurveyResponse(int id) => Id = id;
0 commit comments