I am using a struct to pass to an unmanaged DLL as so -
[StructLayout(LayoutKind.Sequential)]
public struct valTable
{
public byt
Struct constructors are similar to class constructors, except for the following differences:
This means that
A default(parameterless) constructor for a struct could set different
values than the all-zeroed state which would be unexpected behavior. The
.Net Runtime therefore prohabits default constructors for struct.
The typical way to get around this scenario is to create a static method that will create your new instance, initialize it the way you want, and return it. This is the way it is done in .NET to get structures initialized with specific values.
ref; Structs cannot contain explicit parameterless constructors. WHY?