Define Struct

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How I define the following C struction in C#

typedef struct _T_Edit
{
char Name[256];
char EditBox[256];
} T_Edit;

the struct member is :
char [256] Name;
char [256] EditBox;
but the typedef ...
 
Try this

public struct T_Edit

{

// make them public so that the can be access by outside code.

// cannot have field initializers in struct

public char []Name;

public char []EditBox;

public T_Edit(int dummy)// structs cannot have a parameterless constructor

{

Name = new char[256];

EditBox = new char[256];

}

}



Chris
 
Back
Top