Skip to content

Instantly share code, notes, and snippets.

@jwwishart
Created March 4, 2011 22:20
Show Gist options
  • Save jwwishart/855810 to your computer and use it in GitHub Desktop.
Save jwwishart/855810 to your computer and use it in GitHub Desktop.
using System;
namespace String_IsNullOrEmpty_Test
{
class Program
{
static void Main( string [] args ) {
string test1 = null;
string test2 = string.Empty;
string test3 = "";
Console.WriteLine( "Is Null: " + (test1 == null));
Console.WriteLine( "Is Null: " + (test2 == null));
Console.WriteLine( "Is Null: " + (test3 == null));
Console.WriteLine( "Is Empty: " + (test1 == String.Empty));
Console.WriteLine( "Is Empty: " + (test2 == String.Empty));
Console.WriteLine( "Is Empty: " + (test3 == String.Empty));
Console.WriteLine( "IsNullOrEmpty: " + String.IsNullOrEmpty( test1 ) );
Console.WriteLine( "IsNullOrEmpty: " + String.IsNullOrEmpty( test2 ) );
Console.WriteLine( "IsNullOrEmpty: " + String.IsNullOrEmpty( test3 ) );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment