> For the complete documentation index, see [llms.txt](https://andreyakinshin.gitbook.io/problembookdotnet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://andreyakinshin.gitbook.io/problembookdotnet/ru/valuetypes/structlayout-p.md).

# «StructLayout» (Задача)

Что выведет следующий код?

```csharp
public struct Foo
{
  public byte Byte1;
  public int Int1;
}
public struct Bar
{
  public byte Byte1;
  public byte Byte2;
  public byte Byte3;
  public byte Byte4;
  public int Int1;
}
void Main()
{
  Console.WriteLine(Marshal.SizeOf(typeof(Foo)));
  Console.WriteLine(Marshal.SizeOf(typeof(Bar)));
}
```

[Решение](/problembookdotnet/ru/valuetypes/structlayout-s.md)
