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 = 0Everything: typed classes, the span, memory, sequence, stream, and asynchronous readers,
TryParse,Records,SerializeandWrite, in-placeUpdatesetters, path operations, the runtimeLayout, size and offset constants, and views.Parser = 3The smallest reader: typed classes, one
Parse<Name>over a ReadOnlySpan<T> for every struct and union, the unnamed rootParse, size and offset constants, and views (unless Views is off). There is noTryParse, no array or ReadOnlyMemory<T> overload (abyte[]converts to the span), and noDefinitionorRootNameconstant, besides everything the Reader surface leaves out.Reader = 1Typed classes and the readers over bytes already in memory (
ParseandTryParsefor 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 runtimeLayout.Views = 2Views, size and offset constants, and the layout's enums only: no typed class and no reader, so a view has no
ToObjectmethod. 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.