Chat Support
Loupe - Log - Monitor - Resolve
Gibraltar.Agent.Metrics Namespace / SampledMetricDefinition Class / TryGetValue Method / TryGetValue(String,String,String,SampledMetricDefinition) Method
The metrics capture system label of the definition to look up.
The name of the category with which the definition is associated.
The name of the definition within the category.
The output variable to receive the SampledMetricDefinition object if found (null if not).

TryGetValue(String,String,String,SampledMetricDefinition) Method
Retrieve a SampledMetricDefinition by its three key strings (metrics system, category name, and counter name), if present.
Syntax
'Declaration
 
Public Overloads Shared Function TryGetValue( _
   ByVal metricsSystem As String, _
   ByVal categoryName As String, _
   ByVal counterName As String, _
   ByRef value As SampledMetricDefinition _
) As Boolean
 

Parameters

metricsSystem
The metrics capture system label of the definition to look up.
categoryName
The name of the category with which the definition is associated.
counterName
The name of the definition within the category.
value
The output variable to receive the SampledMetricDefinition object if found (null if not).

Return Value

False if no metric definition is registered with the given Key, true if a SampledMetricDefinition is registered with the given Key, or throws an exception if the registered definition is not a SampledMetricDefinition.
Exceptions
ExceptionDescription
The provided metricsSystem, categoryName, or counterName was null.
The metric definition found for the specified key is not a sampled metric definition.
Remarks
This method looks in the collection of registered metric definitions for the specified 3-part key. If it is not found, the output is set to null and the method returns false. If the Id key is found and resolves to a SampledMetricDefinition, it is stored in the value output parameter and the method returns true. If the Id key is found but is not a SampledMetricDefinition, an ArgumentException is thrown to signal a usage inconsistency in your code.
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also