This documentation is archived and is not being maintained.

InstanceData.InstanceData Constructor

Initializes a new instance of the InstanceData class, using the specified sample and performance counter instance.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

public InstanceData (
	string instanceName,
	CounterSample sample
public InstanceData (
	String instanceName, 
	CounterSample sample
public function InstanceData (
	instanceName : String, 
	sample : CounterSample
Not applicable.



The name of an instance associated with the performance counter.


A CounterSample taken from the instance specified by the instanceName parameter.

The following code example creates an InstanceData and displays the values of some of its fields.

// Display the contents of an InstanceData object.
public static void ProcessInstanceDataObject(string name, CounterSample CSRef)

    InstanceData instData = new InstanceData(name, CSRef);
    Console.WriteLine("    Data from InstanceData object:\r\n" +
        "      InstanceName: {0,-31} RawValue: {1}", instData.InstanceName, instData.RawValue);

    CounterSample sample = instData.Sample;
    Console.WriteLine("    Data from CounterSample object:\r\n" +
        "      CounterType: {0,-32} SystemFrequency: {1}\r\n" +
        "      BaseValue: {2,-34} RawValue: {3}\r\n" +
        "      CounterFrequency: {4,-27} CounterTimeStamp: {5}\r\n" +
        "      TimeStamp: {6,-34} TimeStamp100nSec: {7}", sample.CounterType, sample.SystemFrequency, sample.BaseValue, sample.RawValue, sample.CounterFrequency, sample.CounterTimeStamp, sample.TimeStamp, sample.TimeStamp100nSec);

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0