mustaddon / TypeSerialization

.NET Serialization an object type to/from a string/json

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeSerialization NuGet version

Serialization an object type to/from a string

Features

  • Generics support
  • URI safe format

Example 1: Serialization

var str = TypeSerializer.Serialize(typeof(Dictionary<int,string>));
Console.WriteLine(str);

// Console output: 
// Dictionary(Int32-String)

Example 2: Deserialization

var deserializer = new TypeDeserializer(/* add your possible types for resolving */);
var type = deserializer.Deserialize("Dictionary(Int32-String)");
Console.WriteLine(type);

// Console output: 
// System.Collections.Generic.Dictionary`2[System.Int32,System.String]

Program.cs

About

.NET Serialization an object type to/from a string/json

License:MIT License


Languages

Language:C# 99.1%Language:PowerShell 0.9%