PropertyBag.SingleOrDefault<TProperty> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the only property of the TProperty type, or default, and throws an exception if there is more than one element.
public TProperty? SingleOrDefault<TProperty>() where TProperty : Microsoft.Testing.Platform.Extensions.Messages.IProperty;
member this.SingleOrDefault : unit -> 'Property (requires 'Property :> Microsoft.Testing.Platform.Extensions.Messages.IProperty)
Public Function SingleOrDefault(Of TProperty As IProperty) () As TProperty
Type Parameters
- TProperty
The type of the property.
Returns
The single item of the given type or default.
Exceptions
Thrown when more than one property of the given type was found.