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) { // ... }}Parameters
type Type The type to check for compatibility with the YAML converter. Returns
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) { // ... }}Parameters
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. Returns
object? Returns an instance of Int32OrStringV1 constructed from the parsed scalar value. Exceptions
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) { // ... }}Parameters
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. Exceptions
InvalidOperationException Thrown when the provided value is not of type Int32OrStringV1.