Udostępnij za pośrednictwem


HttpMessage.TryGetProperty Method

Definition

Overloads

TryGetProperty(String, Object)

Gets a property that modifies the pipeline behavior. Please refer to individual policies documentation on what properties it supports.

TryGetProperty(Type, Object)

Gets a property that is stored with this HttpMessage instance and can be used for modifying pipeline behavior.

TryGetProperty(String, Object)

Source:
HttpMessage.cs

Gets a property that modifies the pipeline behavior. Please refer to individual policies documentation on what properties it supports.

public bool TryGetProperty (string name, out object? value);
member this.TryGetProperty : string * obj -> bool
Public Function TryGetProperty (name As String, ByRef value As Object) As Boolean

Parameters

name
String

The property name.

value
Object

The property value.

Returns

true if property exists, otherwise. false.

Applies to

TryGetProperty(Type, Object)

Source:
HttpMessage.cs

Gets a property that is stored with this HttpMessage instance and can be used for modifying pipeline behavior.

public bool TryGetProperty (Type type, out object? value);
member this.TryGetProperty : Type * obj -> bool
Public Function TryGetProperty (type As Type, ByRef value As Object) As Boolean

Parameters

type
Type

The property type.

value
Object

The property value.

Returns

true if property exists, otherwise. false.

Remarks

The key value is of type Type for a couple of reasons. Primarily, it allows values to be stored such that though the accessor methods are public, storing values keyed by internal types make them inaccessible to other assemblies. This protects internal values from being overwritten by external code. See the TelemetryDetails and Azure.Core.Pipeline.UserAgentValueKey types for an example of this usage. Secondly, Type comparisons are faster than string comparisons.

Applies to