PostSharp 2023.0 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Utilities Namespace / Unknown­Object­Accessor Structure / Unknown­Object­Accessor Methods / Unknown­Object­Accessor.​Try­Get­Property Method / Unknown­Object­Accessor.​Try­Get­Property(T) Method (String, T)

UnknownObjectAccessor.TryGetProperty<T> Method (String, T)

Gets the value of a named property for the current UnknownObjectAccessor.

Namespace:  PostSharp.Patterns.Utilities
Assembly:  PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 2023.0.3.0 (2023.0.3.0)
Syntax
C#
public bool TryGetProperty<T>(
	string name,
	out T value
)

Parameters

name
Type: System.String
Property name.
value
Type: T
Returns the property value if a property named name exists and its value can be cast to T, otherwise default.

Type Parameters

T
Type of the property value.

Return Value

Type: Boolean
true if the property value if a property named name exists and its value can be cast to T, otherwise false.
See Also