本文介绍了结构中的数组声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
如何在结构中声明数组?
public struct test
{
public byte itemcode;
public byte [] itemname;
/// / 20
public byte 方法;
public string [] controlname4QC;
// 保留公共字符串;
public byte [] reserved;
public void initialize()
{
for ( int i = 0 ; i < 20 ; i ++)
{
reserved [i] = 0 ;
controlname4QC [i] = 0;
}
}
// test * p;
}
此代码是否正确?
解决方案
Hi!
how an array is declare in structure??
public struct test { public byte itemcode; public byte[] itemname; ////20 public byte method; public string[] controlname4QC; // public string reserved; public byte[] reserved; public void initialize() { for (int i = 0; i < 20; i++) { reserved[i] = 0; controlname4QC[i] = "0"; } } //test* p; }
Is this code correct?
解决方案
这篇关于结构中的数组声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!