liveBook · Manning

Compiler directive

A compiler directive is a source-level instruction that controls compilation or directs related tooling without being an ordinary executable statement.

How 2 Manning books explain it

.NET MAUI in Action

A compiler directive is a source-code instruction that controls compilation behavior, including conditional compilation for selected platforms.

How it is used
Controls which platform-specific code is compiled into a .NET MAUI app, especially for native handler customization.
How deep it goes
Demonstrates #if branches within handler mapping and contrasts them with partial classes and runtime platform checks.
Examples
Uses a BorderlessEntry with Android, Windows, iOS, and Mac Catalyst native border-removal branches.
What you can do after
Apply it via .NET MAUI to compile native control customizations only for their intended platforms.

Read how .NET MAUI in Action explains compiler directive →

Learn Go with Pocket-Sized Projects

A compiler directive is a source-level instruction that affects compilation or directs related tooling without being an ordinary executable statement.

How it is used
Uses a compiler directive to embed a corpus file into a Go program for endpoint-related game functionality.
How deep it goes
Explains directive syntax, package-scope placement, compiler handling, and blank imports, but does not develop directive implementation internals.
Examples
Demonstrates //go:embed corpus/english.txt, a package-level string variable, and a blank import of embed.
What you can do after
Apply it via Go's embed package to include a regular file's contents in compiled source.

Read how Learn Go with Pocket-Sized Projects explains compiler directive →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.