Class PropertyBagValue<TValue>
Represents a serializable value that implements the IPropertyBagValue and ISerializable interfaces.
[Serializable]
[KnownType(typeof(byte[]))]
[KnownType(typeof(string[]))]
[KnownType(typeof(Dictionary<string, string>))]
public sealed class PropertyBagValue<TValue> : IPropertyBagValue, IEquatable<IPropertyBagValue>, ISerializable
Type Parameters
TValue
The type of the value.
- Inheritance
-
PropertyBagValue<TValue>
- Implements
- Inherited Members
Remarks
This class is used to store serializable values that are associated with test steps as outcomes. It supports four types of values: string, string[], byte[], and Dictionary<string, string>. It throws an ArgumentException during serialization process if the value to be serialized is not of one of these types.
Constructors
PropertyBagValue(SerializationInfo, StreamingContext)
Initializes a new instance of the PropertyBagValue<TValue> class with serialized data.
public PropertyBagValue(SerializationInfo info, StreamingContext context)
Parameters
info
SerializationInfoThe SerializationInfo that holds the serialized object data about the exception being thrown.
context
StreamingContextThe StreamingContext that contains contextual information about the source or destination.
PropertyBagValue(TValue)
Initializes a new instance of the PropertyBagValue<TValue> class with the specified value.
public PropertyBagValue(TValue value)
Parameters
value
TValueThe value of the serializable property bag value.
Properties
Value
Gets the value of the serializable property bag value.
public TValue Value { get; init; }
Property Value
- TValue
Methods
Equals(object?)
Determines whether the current IPropertyBagValue object is equal to a specified object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
- bool
true
if the current object and obj are both IPropertyBagValue objects and have the same value; otherwise,false
.
Equals(IPropertyBagValue?)
Determines whether the current IPropertyBagValue object is equal to another IPropertyBagValue object.
public bool Equals(IPropertyBagValue? other)
Parameters
other
IPropertyBagValueThe IPropertyBagValue object to compare with the current object.
Returns
- bool
true
if the current object and other have the same value; otherwise,false
.
GetHashCode()
Returns the hash code for the current Error object.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer hash code.
ToString()
Returns a string that represents the current PropertyBagValue object.
public override string? ToString()
Returns
- string
A string that represents the current object.