PropertyCollection.TryGetProperty<TProperty>(Object, TProperty) Method

Definition

Gets the property associated with the specified key.

public:
generic <typename TProperty>
 bool TryGetProperty(System::Object ^ key, [Runtime::InteropServices::Out] TProperty % property);
public bool TryGetProperty<TProperty> (object key, out TProperty property);
member this.TryGetProperty : obj * 'Property -> bool
Public Function TryGetProperty(Of TProperty) (key As Object, ByRef property As TProperty) As Boolean

Type Parameters

TProperty

The type of the property associated with the specified key.

Parameters

key
Object

The key.

property
TProperty

The retrieved property, or default(TValue) if there is no property associated with the specified key.

Returns

true if the property was found, otherwise false.

Exceptions

key is null.

Applies to