Class FormatterBase.TopLevelPropertyBagBase
- Namespace
- StreamJsonRpc
- Assembly
- StreamJsonRpc.dll
A base class for top-level property bags that should be declared in the derived formatter class.
protected abstract class FormatterBase.TopLevelPropertyBagBase
- Inheritance
-
FormatterBase.TopLevelPropertyBagBase
- Inherited Members
Constructors
TopLevelPropertyBagBase(bool)
Initializes a new instance of the FormatterBase.TopLevelPropertyBagBase class.
public TopLevelPropertyBagBase(bool isOutbound)
Parameters
isOutbound
boolA value indicating whether this bag belongs to an outbound message.
Properties
OutboundProperties
Gets a dictionary of top-level properties that should be serialized.
protected Dictionary<string, (Type DeclaredType, object? Value)> OutboundProperties { get; }
Property Value
Exceptions
- InvalidOperationException
Thrown if called on an inbound message.
Methods
TryGetTopLevelProperty<T>(string, out T)
Deserializes the value of a top-level property.
protected abstract bool TryGetTopLevelProperty<T>(string name, out T value)
Parameters
name
stringThe name of the top-level property.
value
TReceives the value of the property.
Returns
- bool
A value indicating whether the property exists.
Type Parameters
T
The type of object expected by the caller.
Exceptions
- Exception
A formatter-specific exception may be thrown if the property exists but the value cannot be deserialized to a
T
.