M
mblatch
Another basic C# question, but haven't figured out how to do this one
either. Am used to defining a list of structures in C++, but am unsure
if you can do this in C#. As a simplified example, I have:
struct Command
{
int commandEnum;
string commandName;
int commandLength;
byte[] command;
}
static Command[] CommandList =
{
{1,"test 1",2,new byte[] {100,101}},
{2,"test 2",2,new byte[] {200,201}}
};
I am wanting to pre-define a list of device commands that follow the
format of the structure. But I've tried many permutations of the
CommandList definition, and the compiler always has a complaint about
what I'm doing. Is this possible and can somebody help me out with the
syntax?
Thanks again,
Mike
either. Am used to defining a list of structures in C++, but am unsure
if you can do this in C#. As a simplified example, I have:
struct Command
{
int commandEnum;
string commandName;
int commandLength;
byte[] command;
}
static Command[] CommandList =
{
{1,"test 1",2,new byte[] {100,101}},
{2,"test 2",2,new byte[] {200,201}}
};
I am wanting to pre-define a list of device commands that follow the
format of the structure. But I've tried many permutations of the
CommandList definition, and the compiler always has a complaint about
what I'm doing. Is this possible and can somebody help me out with the
syntax?
Thanks again,
Mike