Exportar (0) Imprimir
Expandir todo

CounterCreationData.CounterType (Propiedad)

Obtiene o establece el tipo de contador de rendimiento del contador personalizado.

Espacio de nombres: System.Diagnostics
Ensamblado: System (en system.dll)

public PerformanceCounterType CounterType { get; set; }
/** @property */
public PerformanceCounterType get_CounterType ()

/** @property */
public void set_CounterType (PerformanceCounterType value)

public function get CounterType () : PerformanceCounterType

public function set CounterType (value : PerformanceCounterType)

Valor de propiedad

PerformanceCounterType que define el comportamiento del contador de rendimiento.

Tipo de excepciónCondición

InvalidEnumArgumentException

El tipo especificado no es un miembro de la enumeración PerformanceCounterType.

using System;
using System.Diagnostics;

namespace MyDiagnostics
{
   class MyCounterCreationData
   {
      static void Main()
      {
         CounterCreationDataCollection myCol = 
                                    new CounterCreationDataCollection();

         // Create two custom counter objects.
         CounterCreationData myCounter1 = new CounterCreationData("Counter1",
            "First custom counter", PerformanceCounterType.CounterDelta32);

         CounterCreationData myCounter2 = new CounterCreationData();

         // Set the properties of the 'CounterCreationData' object.
         myCounter2.CounterName = "Counter2";
         myCounter2.CounterHelp = "Second custom counter";
         myCounter2.CounterType = PerformanceCounterType.NumberOfItemsHEX32;

         // Add custom counter objects to CounterCreationDataCollection.
         myCol.Add(myCounter1);
         myCol.Add(myCounter2);

         if (PerformanceCounterCategory.Exists("New Counter Category"))
            PerformanceCounterCategory.Delete("New Counter Category");

         // Bind the counters to a PerformanceCounterCategory.
         PerformanceCounterCategory myCategory = 
               PerformanceCounterCategory.Create("New Counter Category", "Category Help", myCol);

         Console.WriteLine("Counter Information:");
         Console.WriteLine("Category Name: " + myCategory.CategoryName);
         for (int i = 0; i < myCol.Count; i++)
         {
            // Display the properties of the CounterCreationData objects.
            Console.WriteLine("CounterName : " + myCol[i].CounterName);
            Console.WriteLine("CounterHelp : " + myCol[i].CounterHelp);
            Console.WriteLine("CounterType : " + myCol[i].CounterType);
         }
      }
   }
}

import System.*;
import System.Diagnostics.*;

class MyCounterCreationData
{
    public static void main(String[] args)
    {
        CounterCreationDataCollection myCol = new CounterCreationDataCollection();

        // Create two custom counter objects.
        CounterCreationData myCounter1 = 
            new CounterCreationData("Counter1", "First custom counter", 
            PerformanceCounterType.CounterDelta32);

        CounterCreationData myCounter2 = new CounterCreationData();

        // Set the properties of the 'CounterCreationData' object.
        myCounter2.set_CounterName("Counter2");
        myCounter2.set_CounterHelp("Second custom counter");
        myCounter2.set_CounterType(PerformanceCounterType.NumberOfItemsHEX32);

        // Add custom counter objects to CounterCreationDataCollection.
        myCol.Add(myCounter1);
        myCol.Add(myCounter2);
        if (PerformanceCounterCategory.Exists("New Counter Category")) {
            PerformanceCounterCategory.Delete("New Counter Category");
        }
        // Bind the counters to a PerformanceCounterCategory.
        PerformanceCounterCategory myCategory = 
            PerformanceCounterCategory.Create("New Counter Category", 
            "Category Help", myCol);

        Console.WriteLine("Counter Information:");
        Console.WriteLine("Category Name: " + myCategory.get_CategoryName());
        for (int i = 0; i < myCol.get_Count(); i++) {
            // Display the properties of the CounterCreationData objects.
            Console.WriteLine("CounterName : " 
                + myCol.get_Item(i).get_CounterName());
            Console.WriteLine("CounterHelp : " 
                + myCol.get_Item(i).get_CounterHelp());
            Console.WriteLine("CounterType : " 
                + myCol.get_Item(i).get_CounterType());
        }
    } //main
} //MyCounterCreationData

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

.NET Framework no admite todas las versiones de cada plataforma. Para obtener una lista de las versiones admitidas, vea Requisitos del sistema.

.NET Framework

Compatible con: 2.0, 1.1, 1.0

Adiciones de comunidad

AGREGAR
Mostrar:
© 2014 Microsoft