Class YamlSerializer
- Namespace
- Cuemon.Runtime.Serialization
- Assembly
- Cuemon.Core.dll
Provides functionality to serialize objects to YAML and to deserialize YAML into objects.
[Obsolete("All YAML marshalling has been moved to its own assembly; Cuemon.Extensions.YamlDotNet. This member will be removed with next major version.")]
public class YamlSerializer
- Inheritance
-
ObjectYamlSerializer
Constructors
YamlSerializer(YamlSerializerOptions)
Initializes a new instance of the YamlSerializer class.
public YamlSerializer(YamlSerializerOptions options)
Parameters
options
YamlSerializerOptionsThe configured YamlSerializerOptions.
Exceptions
- ArgumentException
options
are not in a valid state.
YamlSerializer(Action<YamlSerializerOptions>)
Initializes a new instance of the YamlSerializer class.
public YamlSerializer(Action<YamlSerializerOptions> setup = null)
Parameters
setup
Action<YamlSerializerOptions>The YamlSerializerOptions which may be configured.
Exceptions
- ArgumentException
setup
was unable to configure a valid state of the public read-write properties.
Methods
Deserialize(Stream, Type)
Deserializes the specified value
into an object of objectType
.
public object Deserialize(Stream value, Type objectType)
Parameters
value
StreamThe object to deserialize from YAML format.
objectType
TypeThe type of the object to deserialize.
Returns
- Object
An object of
objectType
.
Deserialize<T>(Stream)
Deserializes the specified value
into an object of T
.
public T Deserialize<T>(Stream value)
Parameters
value
StreamThe object to deserialize from YAML format.
Returns
- T
An object of
T
.
Type Parameters
T
The type of the object to deserialize.
Serialize(Object, Type)
Converts the value of a specified type into a YAML string.
public Stream Serialize(object source, Type inputType)
Parameters
source
ObjectThe value to convert.
inputType
TypeThe type of the value to convert.
Returns
- Stream
The YAML stream representation of the value.
Serialize<T>(T)
Converts the value of a specified type into a YAML string.
public Stream Serialize<T>(T source)
Parameters
source
TThe value to convert.
Returns
- Stream
The YAML stream representation of the value.
Type Parameters
T
The type of the value to serialize.