ReSight.Core.Dynamics 1.1.1

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

ReSight.Core.Dynamics

The ReSight.Core.Dynamics library offers a set of extension methods to seamlessly convert existing objects and collections of key-value pairs into dynamic ExpandoObject instances. This utility aims to simplify dynamic data manipulation, allowing .NET developers to work more flexibly with data structures.

Features

  • Object to ExpandoObject Conversion: Convert any .NET object into an ExpandoObject, dynamically mapping its properties to key-value pairs.
  • IEnumerable<KeyValuePair<string,object>> to ExpandoObject Conversion: Transform any collection of key-value pairs into an ExpandoObject for dynamic access.

Getting Started

Installation

To use ReSight.Core.Dynamics in your project, add it through the NuGet Package Manager or by using the following command in your console:

dotnet add package ReSight.Core.Dynamics

Usage

Converting an Object to an ExpandoObject**

  1. Include the Namespace

    Start by including ReSight.Core.Dynamics at the top of your file:

    using ReSight.Core.Dynamics;
    
  2. Conversion Example

    Convert any object to an ExpandoObject:

    var myObject = new { Name = "John Doe", Age = 30 };
    dynamic expando = myObject.ToExpandoObject();
    Console.WriteLine(expando.Name); // Outputs: John Doe
    

Converting a Collection to an ExpandoObject

  1. Using the Extension Method

    You can also convert a collection of key-value pairs:

    var keyValuePairs = new List<KeyValuePair<string, object>>
    {
    new KeyValuePair<string, object>("Name", "Jane Doe"),
    new KeyValuePair<string, object>("Age", 28)
    };
    dynamic expando = keyValuePairs.ToExpandoObject();
    Console.WriteLine(expando.Name); // Outputs: Jane Doe
    

License

This project is open-sourced under the MIT License.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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 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.
  • net6.0

    • No dependencies.
  • 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.1.1 452 3/21/2024
1.1.0 229 2/2/2024
1.0.0 197 3/21/2024