Table of Contents

Enum GeneratedSurface

Namespace
CStructSharp
Assembly
CStructSharp.dll

Chooses how much code CStructLayoutAttribute generates for a layout. A smaller surface compiles faster and adds less to the assembly; every surface reads the same bytes with the same results and failures.

public enum GeneratedSurface

Fields

Full = 0

Everything: typed classes, the span, memory, sequence, stream, and asynchronous readers, TryParse, Records, Serialize and Write, in-place Update setters, path operations, the runtime Layout, size and offset constants, and views.

Parser = 3

The smallest reader: typed classes, one Parse<Name> over a ReadOnlySpan<T> for every struct and union, the unnamed root Parse, size and offset constants, and views (unless Views is off). There is no TryParse, no array or ReadOnlyMemory<T> overload (a byte[] converts to the span), and no Definition or RootName constant, besides everything the Reader surface leaves out.

Reader = 1

Typed classes and the readers over bytes already in memory (Parse and TryParse for a span, an array, and a ReadOnlyMemory<T>), size and offset constants, and views. There is no writer, Update, stream or sequence reader, Records, path operation, or runtime Layout.

Views = 2

Views, size and offset constants, and the layout's enums only: no typed class and no reader, so a view has no ToObject method. A member a view cannot expose is not available at all with this surface.

Remarks

Every struct and union costs the same generated code however small it is, so the surface matters most for a project with hundreds of layouts of which it reads only a few members each.