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 3
3
4
4
namespace YamlDotNet . Serialization . BufferedDeserialization . TypeDiscriminators
5
5
{
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>
6
12
public interface ITypeDiscriminator
7
13
{
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>
8
19
Type BaseType { get ; }
9
20
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>
10
28
bool TryDiscriminate ( IParser buffer , out Type ? suggestedType ) ;
11
29
}
12
30
}
You can’t perform that action at this time.
0 commit comments