File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
YamlDotNet/Serialization/BufferedDeserialization/TypeDiscriminators Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 33
44namespace YamlDotNet . Serialization . BufferedDeserialization . TypeDiscriminators
55{
6+ /// <summary>
7+ /// An ITypeDiscriminator provides an interface for discriminating which dotnet type to deserialize a yaml
8+ /// stream into. They require the yaml stream to be buffered <see cref="BufferedNodeDeserializer" /> as they
9+ /// can inspect the yaml value, determine the desired type, and reset the yaml stream to then deserialize into
10+ /// that type.
11+ /// </summary>
612 public interface ITypeDiscriminator
713 {
14+ /// <summary>
15+ /// Gets the BaseType of the discriminator. All types that an ITypeDiscriminator may discriminate into must
16+ /// inherit from this type. This enables the deserializer to only buffer values of matching types.
17+ /// If you would like an ITypeDiscriminator to discriminate all yaml values, the BaseType will be object.
18+ /// </summary>
819 Type BaseType { get ; }
920
21+ /// <summary>
22+ /// Trys to discriminate a type from the current IParser. As discriminating the type will consume the parser, the
23+ /// parser will usually need to be a buffer so an instance of the discriminated type can be deserialized later.
24+ /// </summary>
25+ /// <param name="buffer">The IParser to consume and discriminate a type from.</param>
26+ /// <param name="suggestedType">The output type discriminated. Null if no type matched the discriminator.</param>
27+ /// <returns>Returns true if the discriminator matched the yaml stream.</returns>
1028 bool TryDiscriminate ( IParser buffer , out Type ? suggestedType ) ;
1129 }
1230}
You can’t perform that action at this time.
0 commit comments