Fix struct size check in c#