DynamicAnonymousType 1.0.8
dotnet add package DynamicAnonymousType --version 1.0.8
NuGet\Install-Package DynamicAnonymousType -Version 1.0.8
<PackageReference Include="DynamicAnonymousType" Version="1.0.8" />
<PackageVersion Include="DynamicAnonymousType" Version="1.0.8" />
<PackageReference Include="DynamicAnonymousType" />
paket add DynamicAnonymousType --version 1.0.8
#r "nuget: DynamicAnonymousType, 1.0.8"
#:package DynamicAnonymousType@1.0.8
#addin nuget:?package=DynamicAnonymousType&version=1.0.8
#tool nuget:?package=DynamicAnonymousType&version=1.0.8
DynamicAnonymousType
Create anonymous-like .NET types at runtime without defining a class in advance.
DynamicAnonymousType lets you generate a CLR type with named properties and then create instances of it on demand. It is useful when you need a lightweight DTO-like object, a dynamic shape for data transfer, or a runtime-generated type that behaves similarly to an anonymous object.
Features
- Generate CLR types at runtime with strongly typed properties
- Create instances dynamically using property/value tuples
- Reuse the same generated type for repeated property sets
- Includes basic
Equals,GetHashCode, andToStringbehavior for generated instances
Quick start
using DynamicAnonymousType;
Type type = DynamicFactory.CreateType(
("Id", typeof(int)),
("Name", typeof(string)),
("Date", typeof(DateTime?)));
dynamic instance = type.CreateInstance(
("Id", 1),
("Name", "Text1"),
("Date", DateTime.Now));
Console.WriteLine(instance);
Console.WriteLine(instance.Name);
Example output:
{ Id = 1, Name = Text1, Date = 11/12/2026 10:20:35 }
Text1
You can also create an instance first and assign values later:
dynamic person = type.CreateInstance();
person.Id = 2;
person.Name = "Text2";
Why use it?
This library is a compact way to build runtime-shaped objects when you do not want to define a concrete model class up front. It is especially handy for:
- data mapping and transformations
- temporary DTOs
- scaffolding code or tests
- dynamic serialization scenarios
Example project
See the sample app in Examples/Program.cs.
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 is compatible. 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 is compatible. 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. net11.0 is compatible. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Reflection.Emit (>= 4.7.0)
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
-
net11.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on DynamicAnonymousType:
| Package | Downloads |
|---|---|
|
LinqString
IQueryable.Select by property names (EF compatible extensions) |
|
|
HamsterWheel.HLinq
Linq to HTTP Query Language. Allows your api endpoints to be queried via HTTP Query String in a way that resembles EF Linq queries to your DB entities or any other backend supported by Linq. Exposes simple way to select, filter, order and group your data with easy paging support. Extensible, fast and easy to localize. |
|
|
Dino.CloundStorage
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.