Dalk.PropertiesSerializer
1.0.2
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.2
NuGet\Install-Package Dalk.PropertiesSerializer -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="Dalk.PropertiesSerializer" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dalk.PropertiesSerializer --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Dalk.PropertiesSerializer, 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 Dalk.PropertiesSerializer as a Cake Addin #addin nuget:?package=Dalk.PropertiesSerializer&version=1.0.2 // Install Dalk.PropertiesSerializer as a Cake Tool #tool nuget:?package=Dalk.PropertiesSerializer&version=1.0.2
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 | net5.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.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.