[英]How to briefly declare multiple byte arrays in c#
For example, I want to declare the following content but wish to have a simple way. 例如,我想声明以下内容,但希望有一个简单的方法。 And later use each of them separately:
然后分别使用它们:
$byte[] image_bt_update_1 = null;
$byte[] image_bt_update_2 = null;
$byte[] image_bt_update_3 = null;
$byte[] image_bt_update_4 = null;
If you are using C# you can use array of array 如果您使用的是C#,则可以使用array数组
byte[][] image_tb_update = new byte[4][_N];
where _N is dimension of your image_tb_update array 其中_N是image_tb_update数组的尺寸
and refer it as 并称为
image_tb_update[0][0]... image_tb_update[0][_N-1]
image_tb_update[3][0]... image_tb_update[3][_N-1]
to initialize all elemet 初始化所有要素
for (int i=0;i<3;i++)
for (int j=0;i<_N;j++)
image_tb_update[i][j]=0;
由于它们是同一类型,因此可以将它们替换为:
$byte[] image_bt_update_1 = null, image_bt_update_2 = null, image_bt_update_3 = null, image_bt_update_4 = null;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.