求一个C#里面 RankException 错误的例子。。
求一个C#里面 RankException 错误的例子。。
[解决办法]
http://www.gnu.org/software/dotgnu/pnetlib-doc/System/RankException.html
- C# code
using System;public class RankExample { public static void Main() { int[] oneDAry = new int[5]; int[,] twoDAry = new int[2,3]; for (int i = 0; i < 2; i++ ) { oneDAry.SetValue( i, i ); } try { Array.Copy( oneDAry, twoDAry, 2); } catch ( RankException e ) { Console.WriteLine( "Error caught: {0}", e ); } }}