E
erdem
hi all,
i guess this question had been asked many times but i couldnt find a way
how can we generate a struct with managed code with fixed size
i mean
struct easy
{
int a,b,c;
char[] name;
//or it can be string also
// string name;
}
i want all these objects type of easy have size of sizeof(int)*3 (3
variable) + 20 byte for name
i tried this code but it didnt worked out
struct easy
{
int a,b,c;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=20)]
char[] name;
//or it can be string also
// string name;
}
it didnt throw any exception but it also didnt worked
how it can be done???
thanks in advance
erdem...
i guess this question had been asked many times but i couldnt find a way
how can we generate a struct with managed code with fixed size
i mean
struct easy
{
int a,b,c;
char[] name;
//or it can be string also
// string name;
}
i want all these objects type of easy have size of sizeof(int)*3 (3
variable) + 20 byte for name
i tried this code but it didnt worked out
struct easy
{
int a,b,c;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=20)]
char[] name;
//or it can be string also
// string name;
}
it didnt throw any exception but it also didnt worked
how it can be done???
thanks in advance
erdem...