TRENZ.CodeDOM 1.0.11

dotnet add package TRENZ.CodeDOM --version 1.0.11
                    
NuGet\Install-Package TRENZ.CodeDOM -Version 1.0.11
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TRENZ.CodeDOM" Version="1.0.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TRENZ.CodeDOM" Version="1.0.11" />
                    
Directory.Packages.props
<PackageReference Include="TRENZ.CodeDOM" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TRENZ.CodeDOM --version 1.0.11
                    
#r "nuget: TRENZ.CodeDOM, 1.0.11"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TRENZ.CodeDOM@1.0.11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TRENZ.CodeDOM&version=1.0.11
                    
Install as a Cake Addin
#tool nuget:?package=TRENZ.CodeDOM&version=1.0.11
                    
Install as a Cake Tool

TRENZ.CodeDOM

A quasi-language-agnostic code document object model.

Build a type

The main components this library provides are used to build types:

using TRENZ.CodeDOM.Elements;

var cakeType = new ClassType
{
    Name = "Cake",
};

foreach (var prop in ["height", "softness", "sweetness"])
    // a node can be a member, comment, preprocessor command, ...
    cakeType.Nodes.Add(new AutoProperty
    {
        Name = prop,
        Type = typeof(double)
    });

Visit a type

After building your code DOM, you can implement a visitor to do something with it:

using TRENZ.CodeDOM.Visitor;

class MyTypeVisitor : ICodeTypeVisitor
{
    public async Task VisitAsync(ClassType @class)
    {
        Console.WriteLine($"Visiting class {@class.Name}...");

        var nodeVisitor = new MyNodeVisitor();
        foreach (var node in @class.Nodes)
        {
            await node.AcceptAsync(nodeVisitor);
        }
    }

    // [...]
}

class MyNodeVisitor : ICodeNodeVisitor
{
    public Task VisitAsync(AutoProperty autoProperty)
    {
        Console.WriteLine($"Visited auto property {autoProperty.Name}");

        return Task.CompletedTask;
    }

    // [...]
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.11 110 4/27/2026

# 1.0.11
* No changes (nuget.org release)
# 1.0.10
* Added interface `IConstructorVisitor` (extending `ICodeNodeVisitor`), so visitors can choose to not support constructors
# 1.0.9
* Added interface `ICodeNodesContainer` for types that contain `CodeNode`s (`ClassLikeCodeType` and `ExtensionBlock`)
# 1.0.8
* Added `ExtensionBlock` to represent C# 14 extension blocks and new `VisitAsync(ExtensionBlock)` to `ICodeNodeVisitor`
# 1.0.7
* Added `ExplicitInterface` property for `PropertyBase`, `Method` and `Field` to mark them as explicitly implementing an
interface
# 1.0.6
* Improved `TypeRef.ToString` by including `IsArray` and `IsNullable` states
* Removed `Member.Name` validations (code generator must validate before emitting)
# 1.0.5
* Added more constructors to `CodeDomException`
* Address lots of warnings by adding `ConfigureAwait(false)` and argument `null` checks
* Added `init` to all collection properties
* Added `TypeRef.Char`
* Added properties for `Parameter`:
* `IsOut`: for when the parameter is an `out` parameter
* `IsRef`: for when the parameter is a `ref` parameter
* `IsReadonly`: for when the parameter is `readonly` (like in `ref readonly`)
* `IsParams`: for when the parameter is a `params` parameter
# 1.0.4
* Added `IReadOnlyMemberCollection` interface and changed `ClassLikeCodeType` to only return nodes using that, so users don't accidentally add to these collections, thinking they are modifying the class like type
* Made `PreprocessorTypeExtensions` deprecated (will be moved to CodeGen project)
* Added GH Actions workflows for building/publishing
* Updated repository/project homepage URLs
# 1.0.3
* Renamed `Arguments` to `Parameters` in `Constructor` to align with type name (`Collection<Parameter>`)
# 1.0.2
* Renamed `Arguments` to `Parameters` in `PrimaryConstructor` to align with type name (`Collection<Parameter>`)
# 1.0.1
* Downgrade target framework to .NET 8
# 1.0.0
* Initial release