Export (0) Print
Expand All

CounterSet.CreateCounterSetInstance Method

Creates an instance of the counter set.

Namespace:  System.Diagnostics.PerformanceData
Assembly:  System.Core (in System.Core.dll)

[PermissionSetAttribute(SecurityAction.Demand, Unrestricted = true)]
public CounterSetInstance CreateCounterSetInstance(
	string instanceName
)

Parameters

instanceName
Type: System.String
Name of the instance. The name must be unique.

Return Value

Type: System.Diagnostics.PerformanceData.CounterSetInstance
An instance of the counter set which will contain the counter data.

ExceptionCondition
ArgumentException

The instance name is NULL.

InvalidOperationException

You must add counters to the counter set before creating an instance of the counter set.

Call this method one time for single-instance counter sets and one or more times for multiple-instance counter sets.

The provider determines when it creates an instance. If the counter data is more static, the provider can create an instance at initialization time. For example, the number of processors on a computer would be considered static, so a provider that provides counter data for processors could create an instance for each processor on the computer at initialization time. For counters that are more dynamic, such as disk or process counters, the providers would create the new instances in response to a new USB device being added or a new process being created.

The provider should keep the counter data up-to-date at all times.

.NET Framework

Supported in: 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft