March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
namespace Samples
{
public class OverflowExceptionSample
{
public static void Main()
{
try
{
string s = Int64.MaxValue.ToString();
int i = Int32.Parse(s);
}
catch(OverflowException e)
{
Console.WriteLine("Exception: {0}" , e);
}
}
}
}
Exception: System.OverflowException: Value was either too large or too small for an Int32. at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Int32.Parse(String s) at Samples.OverflowExceptionSample.Main() in C:\Books\BCL\Samples\System\ OverflowException\OverflowException.cs:line 12
Read now
Unlock full access