Example
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
Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.