Class YamlConverterFactory
- Namespace
- Cuemon.Text.Yaml
- Assembly
- Cuemon.Core.dll
Provides a factory based way to create and wrap an YamlConverter implementation.
[Obsolete("All YAML marshalling has been moved to its own assembly; Cuemon.Extensions.YamlDotNet. This member will be removed with next major version.")]
public static class YamlConverterFactory
- Inheritance
-
ObjectYamlConverterFactory
Methods
Create(Func<Type, Boolean>, Action<YamlTextWriter, Object, YamlSerializerOptions>, Func<YamlTextReader, Type, YamlSerializerOptions, Object>)
Creates a dynamic instance of an YamlConverter implementation wrapping Cuemon.Text.Yaml.Converters.YamlConverter.WriteYamlCore(Cuemon.Runtime.Serialization.YamlTextWriter,System.Object,Cuemon.Runtime.Serialization.YamlSerializerOptions) through writer
and Cuemon.Text.Yaml.Converters.YamlConverter.ReadYamlCore(Cuemon.Runtime.Serialization.YamlTextReader,System.Type,Cuemon.Runtime.Serialization.YamlSerializerOptions) through reader
.
public static YamlConverter Create(Func<Type, bool> predicate, Action<YamlTextWriter, object, YamlSerializerOptions> writer = null, Func<YamlTextReader, Type, YamlSerializerOptions, object> reader = null)
Parameters
predicate
Func<Type, Boolean>The function delegate that validates if the given System.Type can be converted to or from YAML.
writer
Action<YamlTextWriter, Object, YamlSerializerOptions>The delegate that converts an object to its YAML representation.
reader
Func<YamlTextReader, Type, YamlSerializerOptions, Object>The delegate that generates an object from its YAML representation.
Returns
- YamlConverter
An YamlConverter implementation of an object.
Create(Type, Action<IndentedTextWriter, Object, YamlSerializerOptions>, Func<YamlTextReader, Type, YamlSerializerOptions, Object>)
Creates a dynamic instance of an YamlConverter implementation wrapping Cuemon.Text.Yaml.Converters.YamlConverter.WriteYamlCore(Cuemon.Runtime.Serialization.YamlTextWriter,System.Object,Cuemon.Runtime.Serialization.YamlSerializerOptions) through writer
and Cuemon.Text.Yaml.Converters.YamlConverter.ReadYamlCore(Cuemon.Runtime.Serialization.YamlTextReader,System.Type,Cuemon.Runtime.Serialization.YamlSerializerOptions) through reader
.
public static YamlConverter Create(Type typeToConvert, Action<IndentedTextWriter, object, YamlSerializerOptions> writer = null, Func<YamlTextReader, Type, YamlSerializerOptions, object> reader = null)
Parameters
typeToConvert
TypeThe type to convert.
writer
Action<IndentedTextWriter, Object, YamlSerializerOptions>The delegate that converts an object to its YAML representation.
reader
Func<YamlTextReader, Type, YamlSerializerOptions, Object>The delegate that generates an object from its YAML representation.
Returns
- YamlConverter
An YamlConverter implementation of an object.
Create<T>(Action<YamlTextWriter, T, YamlSerializerOptions>, Func<YamlTextReader, Type, YamlSerializerOptions, T>)
Creates a dynamic instance of an YamlConverter<T> implementation wrapping WriteYaml(YamlTextWriter, T, YamlSerializerOptions) through writer
and ReadYaml(YamlTextReader, Type, YamlSerializerOptions) through reader
.
public static YamlConverter Create<T>(Action<YamlTextWriter, T, YamlSerializerOptions> writer = null, Func<YamlTextReader, Type, YamlSerializerOptions, T> reader = null)
Parameters
writer
Action<YamlTextWriter, T, YamlSerializerOptions>The delegate that converts
T
to its YAML representation.reader
Func<YamlTextReader, Type, YamlSerializerOptions, T>The delegate that generates
T
from its YAML representation.
Returns
- YamlConverter
An YamlConverter implementation of
T
.
Type Parameters
T
The type to implement an YamlConverter for.
Create<T>(Func<Type, Boolean>, Action<YamlTextWriter, T, YamlSerializerOptions>, Func<YamlTextReader, Type, YamlSerializerOptions, T>)
Creates a dynamic instance of an YamlConverter<T> implementation wrapping WriteYaml(YamlTextWriter, T, YamlSerializerOptions) through writer
and ReadYaml(YamlTextReader, Type, YamlSerializerOptions) through reader
.
public static YamlConverter Create<T>(Func<Type, bool> predicate, Action<YamlTextWriter, T, YamlSerializerOptions> writer = null, Func<YamlTextReader, Type, YamlSerializerOptions, T> reader = null)
Parameters
predicate
Func<Type, Boolean>The function delegate that validates if the given System.Type can be converted to or from YAML.
writer
Action<YamlTextWriter, T, YamlSerializerOptions>The delegate that converts
T
to its YAML representation.reader
Func<YamlTextReader, Type, YamlSerializerOptions, T>The delegate that generates
T
from its YAML representation.
Returns
- YamlConverter
An YamlConverter implementation of
T
.
Type Parameters
T
The type to implement an YamlConverter for.