Skip to content

Commit

Permalink
Tidy up csrefKeywordsLiteral snippet (#38056)
Browse files Browse the repository at this point in the history
* Tidy up `csrefKeywordsLiteral` snippet

* Update samples/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsLiteral/CS/csrefKeywordsLiteral.cs

---------

Co-authored-by: Bill Wagner <[email protected]>
  • Loading branch information
Rageking8 and BillWagner authored Nov 15, 2023
1 parent 739a134 commit 8573cfb
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NullExamples
{
//<snippet1>

class Program
{
class MyClass
{
public void MyMethod() { }
}

static void Main(string[] args)
static void Main()
{
// Set a breakpoint here to see that mc = null.
// However, the compiler considers it "unassigned."
Expand Down Expand Up @@ -45,8 +41,7 @@ static void Main(string[] args)
string t = String.Empty; // Logically the same as ""

// Equals applied to any null object returns false.
bool b = (t.Equals(s));
Console.WriteLine(b);
Console.WriteLine("t.Equals(s) is {0}", t.Equals(s));

// Equality operator also returns false when one
// operand is null.
Expand All @@ -62,8 +57,6 @@ static void Main(string[] args)
int? i = null;

// Keep the console window open in debug mode.
System.Console.WriteLine("Press any key to exit.");
System.Console.ReadKey();
}
}
//</snippet1>
Expand Down

0 comments on commit 8573cfb

Please sign in to comment.