TRENZ.CodeDOM
1.0.11
dotnet add package TRENZ.CodeDOM --version 1.0.11
NuGet\Install-Package TRENZ.CodeDOM -Version 1.0.11
<PackageReference Include="TRENZ.CodeDOM" Version="1.0.11" />
<PackageVersion Include="TRENZ.CodeDOM" Version="1.0.11" />
<PackageReference Include="TRENZ.CodeDOM" />
paket add TRENZ.CodeDOM --version 1.0.11
#r "nuget: TRENZ.CodeDOM, 1.0.11"
#:package TRENZ.CodeDOM@1.0.11
#addin nuget:?package=TRENZ.CodeDOM&version=1.0.11
#tool nuget:?package=TRENZ.CodeDOM&version=1.0.11
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 | Versions 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. |
-
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