读书人

C#里面 RankException 异常的例子。

发布时间: 2012-10-12 10:17:04 作者: rapoo

求一个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 );      }   }} 

读书人网 >C#

热点推荐