App Metrics Fork me on GitHub
Show / Hide Table of Contents

Struct TimerContext

This struct is meant to be returned by the timer.NewContext() method and is intended to be used inside a using statement:

using(timer.NewContext())
{
ExecuteMethodThatNeedsMonitoring();
}
Double disposing the instance, or a copy of the instance (since it is a struct) will cause the timer to record wrong values. Stick to directly passing it to the using() statement.

Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
Namespace:App.Metrics.Timer
Assembly:cs.temp.dll.dll
Syntax
public struct TimerContext : IDisposable

Constructors

TimerContext(ITimer, String)

Declaration
public TimerContext(ITimer timer, string userValue)
Parameters
Type Name Description
ITimer timer
System.String userValue

Properties

Elapsed

Gets the currently elapsed time from when the instance has been created

Declaration
public TimeSpan Elapsed { get; }
Property Value
Type Description
System.TimeSpan

The elapsed.

Methods

Dispose()

Declaration
public void Dispose()
Implements
System.IDisposable.Dispose()

TrackUserValue(String)

Set the user value for this timer context.

Declaration
public void TrackUserValue(string value)
Parameters
Type Name Description
System.String value

New user value to use for this context.

Back to top Copyright © 2017 Allan Hardy
Generated by DocFX