size of array of structs in bytes

Marshal.SizeOf(typeof(MyStruct)) * array.Length


There is the sizeof operator. However, it can only be used in unsafe context.

There is also a difference to the method proposed in the other answer, namingly:

For all other types, including structs, the sizeof operator can be used only in unsafe code blocks. Although you can use the Marshal.SizeOf method, the value returned by this method is not always the same as the value returned by sizeof. Marshal.SizeOf returns the size after the type has been marshaled, whereas sizeof returns the size as it has been allocated by the common language runtime, including any padding.

source

Example:

unsafe
{
  int size = sizeof(MyStruct)*myArray.Length;
}

Tags:

C#