DynamicTypes 1.0.4

dotnet add package DynamicTypes --version 1.0.4
                    
NuGet\Install-Package DynamicTypes -Version 1.0.4
                    
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="DynamicTypes" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DynamicTypes" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="DynamicTypes" />
                    
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 DynamicTypes --version 1.0.4
                    
#r "nuget: DynamicTypes, 1.0.4"
                    
#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.
#addin nuget:?package=DynamicTypes&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=DynamicTypes&version=1.0.4
                    
Install as a Cake Tool

DynamicTypes

The DynamicTypes package is a useful tool for C# developers who want to work with dynamic types. This package provides a set of extension methods that make it easy to work with dynamic objects, such as parsing JSON or accessing properties dynamically.

One of the benefits of using DynamicTypes is that it eliminates the need for casting and type checking, which can save time and reduce code complexity. Additionally, this package can help with serialization and deserialization of dynamic objects, making it easier to work with data in different formats.

Overall, the DynamicTypes package is a valuable tool for any C# developer who wants to simplify their code and work more efficiently with dynamic types.

Howto Use

Example

            PropertyGenerator? innerProperty = null;

            //Create a TypeGenerator for the inner Type
            var generator1 = new TypeGenerator("InnerType")
            {
                InterfaceImplementations = { typeof(IExample) },
                Members =  {
                    new iPropertyGenerator<IExample>(nameof(IExample.Property1)),
                },
            };

            //Create second Type Generator
            var generator2 = new TypeGenerator
            {
                InterfaceImplementations = { typeof(IExample) },
                //add DebuggerDisplayAttribute
                Attributes = { new AttributeGenerator<DebuggerDisplayAttribute>("Generated - IExample.Property1:{Property1}") },
                //define members
                Members =
                {
                    new PropertyGenerator(nameof(IExample.Property1), typeof(string)) { OverrideDefinition = typeof(IExample) },
                    //Create the Property Containing the type of generator1
                     (innerProperty = new PropertyGenerator("Type1", generator1.Compile())
                        {
                            Attributes = { new AttributeGenerator<MyAttribute>("Default") }
                        }),
                },
            };
            generator2.Compile();

            var instance = generator2.CreateInstance();

            //set the value via PropertyGenerator extension
            innerProperty.SetValue(instance, generator1.CreateInstance());

            //set the value via interface
            ((IExample)instance).Property1 = "A value";

            //set the value a bit more complicated
            generator1.Type.GetProperty(nameof(IExample.Property1)).SetValue(innerProperty.GetValue(instance), "Also a value");

COMWrapper

The COMWrapper is an Example to see how to use this Libary.

  1. The COM Wrapper class wrappers COM interface classes and Provides IDisposable and Finalize implementation.
  2. The COM Resource will be freed in on Dispose
Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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.
  • net7.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DynamicTypes:

Package Downloads
DynamicTypes.Utilities

Utilities for the DynamicTypes Libary

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 895 7/3/2023
1.0.3 216 4/5/2023
1.0.1 224 3/24/2023
1.0.0 217 3/24/2023