Skip to content

Commit 48ad5a8

Browse files
committed
add xml comments for IValueTypeDiscriminator
1 parent 0116037 commit 48ad5a8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

YamlDotNet/Serialization/BufferedDeserialization/TypeDiscriminators/IValueTypeDiscriminator.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,28 @@
33

44
namespace 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
}

0 commit comments

Comments
 (0)