Skip to content

Instantly share code, notes, and snippets.

@sherpc
Created May 13, 2012 21:49
Show Gist options
  • Save sherpc/2690395 to your computer and use it in GitHub Desktop.
Save sherpc/2690395 to your computer and use it in GitHub Desktop.
Null tests
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NullTest
{
class SomeClass
{
}
class Program
{
static void Main(string[] args)
{
TestNullArgument(new SomeClass());
TestNullArgument((SomeClass)null);
}
static void TestNullArgument(SomeClass arg)
{
bool isNull = arg == null;
Console.WriteLine("Arg is null: {0}", isNull);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NullTest
{
class SomeClass
{
}
class Program
{
static void Main(string[] args)
{
TestNullArgument(new SomeClass());
TestNullArgument();
/ }
static void TestNullArgument(SomeClass arg = null)
{
bool isNull = arg == null;
Console.WriteLine("Arg is null: {0}", isNull);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment