March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
namespace Samples
{
public class NullReferenceExceptionSample
{
public static void Main()
{
string s = null;
try
{
Console.WriteLine(s.ToUpper());
}
catch(NullReferenceException e)
{
Console.WriteLine("Exception: {0}", e);
}
}
}
}
Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Samples.NullReferenceExceptionSample.Main() in C:\Books\BCL\Samples\System\ NullReferenceException\NullReferenceException.cs:line 12
Read now
Unlock full access