PropertyBag.FirstOrDefault<TProperty> Method

Definition

Returns the first property of the TProperty type, or default if none is found. Unlike SingleOrDefault<TProperty>(), this method does not throw when multiple properties of the same type are present β€” it simply returns the first one encountered.

public TProperty? FirstOrDefault<TProperty>() where TProperty : Microsoft.Testing.Platform.Extensions.Messages.IProperty;
member this.FirstOrDefault : unit -> 'Property (requires 'Property :> Microsoft.Testing.Platform.Extensions.Messages.IProperty)
Public Function FirstOrDefault(Of TProperty As IProperty) () As TProperty

Type Parameters

TProperty

The type of the property.

Returns

TProperty

The first property of the given type, or default if none is found.

Applies to