Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

YamlSerializerContext

OfficeIMO.Yaml

Namespace
OfficeIMO.Yaml
Assembly
OfficeIMO.Yaml
Source revision
0eef6a5756b9 with working tree changes
Modifiers
abstract

The base of generated serialization metadata. Declare a partial class that derives from it and lists its root types with YamlSerializableAttribute; the source generator fills in metadata for those types and every type they reach, so serialization needs no reflection and works with trimming and NativeAOT.

Inheritance

  • object
  • YamlSerializerContext

Usage

Explore 4 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 4

Examples

[YamlSerializable(typeof(AppConfig))]
internal partial class AppYamlContext : YamlSerializerContext { }

string yaml = YamlSerializer.Serialize(config, AppYamlContext.Default.AppConfig);
AppConfig? copy = YamlSerializer.Deserialize(yaml, AppYamlContext.Default.AppConfig);

Methods

public YamlTypeInfo? GetTypeInfo(Type type) #

Returns the metadata for type bound to YamlSerializerContext.Options, or null when the context does not include it.

Parameters

type System.Type required

Returns

YamlTypeInfo?

Properties

public YamlSerializerOptions Options { get; } #

Gets the options the context's metadata is bound to.