what if you have a structure like this:

struct foo
{
public int A;
public char[] B;
}

the size of the structure obviously changes depending on the size of the char array inside it. Is there a "correct" way to get the size of the struct so that it would include the size of the character array?
sizeof() obviously will not work... i could check the length of the array at runtime to get the size of the struct, but i was just wondering if there is a function for doing this already