Dalk.PropertiesSerializer
1.0.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Dalk.PropertiesSerializer --version 1.0.1
NuGet\Install-Package Dalk.PropertiesSerializer -Version 1.0.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="Dalk.PropertiesSerializer" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dalk.PropertiesSerializer --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Dalk.PropertiesSerializer, 1.0.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.
// Install Dalk.PropertiesSerializer as a Cake Addin #addin nuget:?package=Dalk.PropertiesSerializer&version=1.0.1 // Install Dalk.PropertiesSerializer as a Cake Tool #tool nuget:?package=Dalk.PropertiesSerializer&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Dalk.Properties
A properties serializer for C#
Documentation
import the classes
// import the serializer classes
using Dalk.PropertiesSerializer;
create a type to serialize
using Dalk.PropertiesSerializer;
public class TestObject
{
// use the attribute to specify a custom name
[PropertyName("test_int")]
public int TestInt { get; set; }
public string TestString { get; set; }
public bool TestBool { get; set; }
public SecondTestObject SecondTestObject { get; set; }
}
serialize an object
string properties = Serializer.Serialize(@object);
deserialize a string
var @object = Serializer.Deserialize<TestObject>(properties);
create a custom type serializer
using System;
using Dalk.PropertiesSerializer.TypeSerializers;
[TypeSerializer]
public class TestTypeSerializer : ITypeSerializer
{
public object Deserialize(string o) => TestType.Parse(o);
Type type = typeof(TestType);
public Type GetCType() => type;
public string Serialize(object o) => o.ToString();
}
register all type type serializers from the current assembly
Serializer.LoadTypeSerializersFromAssembly(Assembly.GetAssembly(GetType()));
add an object as a type serializer
Serializer.AddCustomTypeSerializer(new TestTypeSerializer());
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.7.2
- 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.