LoginSignup
2
2

More than 5 years have passed since last update.

VBの人の2次元配列は・・・ジャグ配列

Posted at

VBやもっと古いソースでは大量の2次元配列が出てくるとおもいます。

new ar_rect int[,] { { 1, 0 },
                     { 0, 4 },
                     { 5, 0 } };

VB.NETで階層的にループするために機械的にこう置き換えると思います。

var ar_jag = new int[][] { new int[] { 1, 0 },
                           new int[] { 0, 4 },
                           new int[] { 5, 0 } };

 VBの人は実際に必要な物がこうであっても2次元配列を
使うので気を付けましょう。

var dic = new Dictionary< Tuple<int,int> , int >(){
     { Tuple.Create(0,0) , 1 }
    ,{ Tuple.Create(1,1) , 4 }
    ,{ Tuple.Create(2,0) , 5 }
};

 頻発するなら、この例のTupleよりも、メンバーにx,yやrow,columnを持った
Point某を作っても良いと思います

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2