Comptime
A .NET source generator that executes methods at compile time and serializes their results to C# code. Comptime brings meta-programming capabilities to C#, enabling compile-time code generation and evaluation.
Overview
Comptime allows you to mark methods with the [Comptime] attribute to have them executed during compilation. The return values are serialized into C# source code and used at runtime, eliminating the need for runtime computation of values that can be determined at build time.
This meta-programming approach enables developers to shift expensive computations from runtime to compile time, resulting in faster application startup and execution.
Features
Compile-time execution : Methods marked with [Comptime] are executed during compilation
: Methods marked with are executed during compilation Method parameters : Methods can accept parameters with compile-time constant expressions
: Methods can accept parameters with compile-time constant expressions C# serialization : Results are serialized to valid C# code
: Results are serialized to valid C# code Supported return types : Primitive types: int , long , short , byte , sbyte , uint , ulong , ushort , float , double , decimal , bool , char , string Collections: IReadOnlyList
... continue reading