March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
namespace Samples
{
class ArgumentOutOfRangeExceptionSample
{
public static void Main()
{
int[] array1 = {42, 42};
int[] array2 = {0, 0};
try
{
Array.Copy(array1, array2, -1);
}
catch(ArgumentOutOfRangeException e)
{
Console.WriteLine(e);
}
}
}
}
System.ArgumentOutOfRangeException: Non-negative number required. Parameter name: length at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length) at System.Array.Copy(Array sourceArray, Array destinationArray, Int32 length) at Samples.ArgumentOutOfRangeExceptionSample.Main() in C:\Books\BCL\Samples\ System\ArgumentOutOfRangeException\ArgumentOutOfRangeException.cs:line 13
Read now
Unlock full access