Skip to content
Docs Try Aspire

IntOrStringYamlConverter Methods

Class Methods 3 members
Provides a custom YAML type converter that facilitates serialization and deserialization of objects of type Int32OrStringV1. This converter supports both integers and strings.
Determines whether the given type is supported by this YAML type converter.
public class IntOrStringYamlConverter
{
public bool Accepts(
Type type)
{
// ...
}
}
type Type The type to check for compatibility with the YAML converter.
bool Returns true if the specified type is Int32OrStringV1, otherwise false.
ReadYaml(IParser, Type, ObjectDeserializer) Section titled ReadYaml(IParser, Type, ObjectDeserializer) nullable object?
Reads a YAML scalar from the parser and converts it into an instance of Int32OrStringV1.
public class IntOrStringYamlConverter
{
public object? ReadYaml(
IParser parser,
Type type,
ObjectDeserializer rootDeserializer)
{
// ...
}
}
parser IParser The YAML parser to read the scalar value from.
type Type The target type for deserialization, expected to be Int32OrStringV1.
rootDeserializer ObjectDeserializer The root deserializer used for handling nested deserialization.
object? Returns an instance of Int32OrStringV1 constructed from the parsed scalar value.
InvalidOperationException Thrown if the current YAML event is not a scalar.
WriteYaml(IEmitter, object?, Type, ObjectSerializer) Section titled WriteYaml(IEmitter, object?, Type, ObjectSerializer)
Writes the given object to the provided YAML emitter using the appropriate format.
public class IntOrStringYamlConverter
{
public void WriteYaml(
IEmitter emitter,
object? value,
Type type,
ObjectSerializer serializer)
{
// ...
}
}
emitter IEmitter The emitter used to write the YAML output.
value object? The object to be serialized. Expected to be of type Int32OrStringV1.
type Type The type of the object being serialized.
serializer ObjectSerializer The serializer to be used for complex object serialization.
InvalidOperationException Thrown when the provided value is not of type Int32OrStringV1.