GDSerializer 2.0.3
dotnet add package GDSerializer --version 2.0.3
NuGet\Install-Package GDSerializer -Version 2.0.3
<PackageReference Include="GDSerializer" Version="2.0.3" />
paket add GDSerializer --version 2.0.3
#r "nuget: GDSerializer, 2.0.3"
// Install GDSerializer as a Cake Addin #addin nuget:?package=GDSerializer&version=2.0.3 // Install GDSerializer as a Cake Tool #tool nuget:?package=GDSerializer&version=2.0.3
GDSerializer
GDSerializer is an XML serialization (and deserialization) library developed with Godot's C# API in mind.
It supports (de)serialization of almost any C# type including collections and managed types, and provides an interface to create custom (de)serializers that can then be used by the default implementation to further increase its capabilities.
Installation
GDSerializer is available as a NuGet package, which can be installed either through an IDE or by manually including the following lines in a Godot project's .csproj
file:
<ItemGroup>
<PackageReference Include="GDSerializer" Version="2.0.3"/>
</ItemGroup>
Its dependencies may need to be installed as well, in a similar fashion.
Due to a bug in Godot, the following lines will also need to be included in the .csproj
file to properly compile along with NuGet packages:
<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
Note that GDSerializer targets .NET Standard 2.1
whereas Godot projects target .NET Framework 4.7.2
by default, so the target framework may need to be changed either through an IDE or by manually editing the .csproj
file like so:
<TargetFramework>netstandard2.1</TargetFramework>
It is also recommended to enable nullability warnings in the project; however, this is completely optional. Again, this can be done either through an IDE or by including the following lines in the .csproj
file:
<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>
Usage
Creating a new serializer instance:
Serializer serializer = new(); // or new Serializer() for older language versions that do not recognise target-typed new()
Serializing an object as an XML node:
XmlNode xml = serializer.Serialize(obj);
Deserializing an XML node as an object:
object? obj = serializer.Deserialize(xml);
An optional type argument can be provided for both serialization and deserialization, in order to assist the serializer with figuring out the object's Type
.
Generic versions of the methods can also be used.
More detailed instructions on using the Serializer
class can be found on the GDSerializer wiki.
Product | Versions 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Carnagion.MoreLinq (>= 1.4.0)
- System.CodeDom (>= 6.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on GDSerializer:
Package | Downloads |
---|---|
Modot
A mod loader and API for applications made using Godot, with the ability to load C# assemblies, XML data, and resource packs at runtime. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on GDSerializer:
Repository | Stars |
---|---|
Carnagion/Modot
A mod loader and API for applications made using Godot, with the ability to load C# assemblies, XML data, and resource packs at runtime.
|