Example
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
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.