March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
namespace Samples
{
public class RankExceptionSample
{
public static void Main()
{
try
{
Array a = Array.CreateInstance(
typeof(int), 5);
Array b = Array.CreateInstance(
typeof(int), 5, 5);
Array.Copy(a, b, 5);
}
catch(RankException e)
{
Console.WriteLine("Exception: {0}" , e);
}
}
}
}
Exception: System.RankException: The specified arrays must have the same number of dimensions. 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.RankExceptionSample.Main() in C:\Books\BCL\Samples\System\ RankException\RankException.cs:line 15
Read now
Unlock full access