[英]How to briefly declare multiple byte arrays in c#
例如,我想聲明以下內容,但希望有一個簡單的方法。 然后分別使用它們:
$byte[] image_bt_update_1 = null;
$byte[] image_bt_update_2 = null;
$byte[] image_bt_update_3 = null;
$byte[] image_bt_update_4 = null;
如果您使用的是C#,則可以使用array數組
byte[][] image_tb_update = new byte[4][_N];
其中_N是image_tb_update數組的尺寸
並稱為
image_tb_update[0][0]... image_tb_update[0][_N-1]
image_tb_update[3][0]... image_tb_update[3][_N-1]
初始化所有要素
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.