CloudNDevOps.Newtonsoft.Extensions 1.0.2

There is a newer version of this package available.
See the version list below for details.

Requires NuGet 2.12 or higher.

dotnet add package CloudNDevOps.Newtonsoft.Extensions --version 1.0.2                
NuGet\Install-Package CloudNDevOps.Newtonsoft.Extensions -Version 1.0.2                
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="CloudNDevOps.Newtonsoft.Extensions" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CloudNDevOps.Newtonsoft.Extensions --version 1.0.2                
#r "nuget: CloudNDevOps.Newtonsoft.Extensions, 1.0.2"                
#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.
// Install CloudNDevOps.Newtonsoft.Extensions as a Cake Addin
#addin nuget:?package=CloudNDevOps.Newtonsoft.Extensions&version=1.0.2

// Install CloudNDevOps.Newtonsoft.Extensions as a Cake Tool
#tool nuget:?package=CloudNDevOps.Newtonsoft.Extensions&version=1.0.2                

CloudNDevOps.Newtonsoft.Extensions

CloudNDevOps.Newtonsoft.Extensions is a library that extends functionality provided by Newtonsoft needed by common applications. One of such functionalities is ability to de-serialize collection of object families.

Installation

Use the package manager NuGet to install CloudNDevOps.Newtonsoft.Extensions.

Install-Package CloudNDevOps.Newtonsoft.Extensions -Version 1.0.2

Usage

Define Types

public class Customer
{
    public string Identifier { get; set; }

    public string Classifier { get; set; }
}

public class Individual : Customer
{
    public string FirstName { get; set; }

    public string LastName { get; set; }
}

public class Organization : Customer
{
    public string Name { get; set; }
}

Create Instance of Converter

First parameter is function, which need to return value of classifier based on instance of object. Second parameter is dictionary of value of classifier and type of derived class.

var typeFamilyConverter = new TypeFamilyConverter<Customer, string>(
    new Func<Customer, string>(e => e.Classifier),
    new Dictionary<string, Type>
    {
        { "Individual", typeof(Individual) },
        { "Organization", typeof(Organization) }
    });

De-Serialize using Newtonsoft JsonConvert Class

var result = JsonConvert.DeserializeObject<List<Customer>>(
    inputString,
    new JsonSerializerSettings
    {
        Converters = { typeFamilyConverter }
    });
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 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. 
.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 was computed. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.4 17,384 5/25/2020
1.0.3 448 5/25/2020
1.0.2 5,602 5/10/2020
1.0.1-beta1 372 5/10/2020