Skip to content

Commit cb62b49

Browse files
gewarrenBillWagner
andauthored
Apply suggestions from code review
Co-authored-by: Bill Wagner <[email protected]>
1 parent 1f36747 commit cb62b49

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

snippets/csharp/System/NullReferenceException/Overview/Array1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class Array1Example
55
{
66
public static void Main()
77
{
8-
string[] values = { "one", null, "two" };
8+
string[] values = [ "one", null, "two" ];
99
for (int ctr = 0; ctr <= values.GetUpperBound(0); ctr++)
1010
Console.Write("{0}{1}", values[ctr].Trim(),
1111
ctr == values.GetUpperBound(0) ? "" : ", ");

snippets/csharp/System/NullReferenceException/Overview/Array2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class Array2Example
55
{
66
public static void Main()
77
{
8-
string[] values = { "one", null, "two" };
8+
string[] values = [ "one", null, "two" ];
99
for (int ctr = 0; ctr <= values.GetUpperBound(0); ctr++)
1010
Console.Write("{0}{1}",
1111
values[ctr] != null ? values[ctr].Trim() : "",

snippets/csharp/System/NullReferenceException/Overview/Chain1.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static void Main()
1111
if (!string.IsNullOrEmpty(pages.CurrentPage.Title))
1212
{
1313
string title = pages.CurrentPage.Title;
14-
Console.WriteLine("Current title: '{0}'", title);
14+
Console.WriteLine($"Current title: '{title}'");
1515
}
1616
}
1717
}
@@ -44,7 +44,7 @@ public Page PreviousPage
4444
{
4545
if (_ctr == 0)
4646
{
47-
if (_page[0] == null)
47+
if (_page[0] is null)
4848
return null;
4949
else
5050
return _page[0];

snippets/csharp/System/NullReferenceException/Overview/Chain2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static void Main()
1010
if (current != null)
1111
{
1212
string title = current.Title;
13-
Console.WriteLine("Current title: '{0}'", title);
13+
Console.WriteLine($"Current title: '{title}'");
1414
}
1515
else
1616
{

snippets/csharp/System/NullReferenceException/Overview/nullreturn2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static void Main()
1919

2020
public class Person
2121
{
22-
public static Person[] AddRange(string[] firstNames)
22+
public static Person[] AddRange(params string[] firstNames)
2323
{
2424
Person[] p = new Person[firstNames.Length];
2525
for (int ctr = 0; ctr < firstNames.Length; ctr++)

0 commit comments

Comments
 (0)