KsWare.YamlDotNet 13.0.6

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

// Install KsWare.YamlDotNet as a Cake Tool
#tool nuget:?package=KsWare.YamlDotNet&version=13.0.6                

KsWare.YamlDotNet

KsWare.YamlDotNet is a fork of YamlDotNet with the aim of improving expandability and usability.

YamlDotNet is a YAML library for netstandard and other .NET runtimes.

YamlDotNet provides low level parsing and emitting of YAML as well as a high level object model similar to XmlDocument. A serialization library is also included that allows to read and write objects from and to YAML streams.

Features

ALPHA Version. All features are preliminary und subject to change.

  • supported TargetVersions: net60;netstandard2.0;netstandard2.1;net48;(net70?)
    • unsupported: net35;net40;net45;net47;
  • Feature #1: De-/SerializerBuilder in Emitter/Parser
  • Feature #2: YamlConverterAttribute

The current build is based on YamlDotNet 13.0.2.

The API remains fully compatible with YamlDotNet.
The YamlDotNet package can be easily replaced by KsWare.YamlDotNet

Feature #1: De-/SerializerBuilder in Emitter/Parser

  • new class SerializerBuilderData
  • new API IEmitter.SerializerBuilderData
  • new class DeserializerBuilderData
  • new API IParser.DeserializerBuilderData

Now you can get all information about the SerializerBuilder (and Serializer) while writing a IYamlConverter.

public class MyObjectConverter : IYamlTypeConverter {

    public object? ReadYaml(IParser parser, Type type) {
        var deserializer = parser.DeserializerBuilderData.Build();
        ...
    }

    public void WriteYaml(IEmitter emitter, object value, Type type) {
		var serializer = emitter.SerializerBuilderData.Build();
        var dvh = emitter.SerializerBuilderData.DefaultValuesHandlingConfiguration;
		var nc = emitter.SerializerBuilderData.NamingConvention;
        ...
    }
}

Feature #2: YamlConverterAttribute

  • new class YamlConverterAttribute

Now you can specfify a converter for a property. (like in JsonConverter) without to configure a special serializer

class MyClass {
    [YamlConverter(typeof(MyObjectConverter)]
    public object MyProperty {get;set;}
}

Drawbacks

Due to lack of resources this librray does not support all target frameworks of the original and application testing is done for the KsWare development environment only.

Credits

The code is mainly based on the work of Antoine Aubry and contributors, who published the original material at https://github.com/aaubry/YamlDotNet. Thanks for the great work!

If you find my additional feature useful, feel free to use it in your projects or suggest it to the original project.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 is compatible.  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 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  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
13.0.6 292 4/12/2023
13.0.5 186 4/10/2023
13.0.4 187 4/7/2023
13.0.3 218 4/4/2023