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
TValueThe 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
infoSerializationInfoThe SerializationInfo that holds the serialized object data about the exception being thrown.
contextStreamingContextThe 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
valueTValueThe 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
objobjectThe object to compare with the current object.
Returns
- bool
trueif 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
otherIPropertyBagValueThe IPropertyBagValue object to compare with the current object.
Returns
- bool
trueif 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.