InstrumentationType InstrumentationType InstrumentationType InstrumentationType Enum

Definition

Gibt den Typ der von einer Klasse bereitgestellten Instrumentierung an.Specifies the type of instrumentation provided by a class.

Hinweis: Die WMI .NET-Bibliotheken werden jetzt als abgeschlossen betrachtet, und keine weiteren Entwicklungen, Verbesserungen oder Updates werden für nicht sicherheitsrelevante Aspekte verfügbar sein, die diese Bibliotheken betreffen.Note: the WMI .NET libraries are now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. Die MI-APIs sollten für alle Neuentwicklungen verwendet werden.The MI APIs should be used for all new development.

public enum class InstrumentationType
public enum InstrumentationType
type InstrumentationType = 
Public Enum InstrumentationType
Vererbung
InstrumentationTypeInstrumentationTypeInstrumentationTypeInstrumentationType

Felder

Abstract Abstract Abstract Abstract 2

Die Klasse definiert eine abstrakte Klasse für die Verwaltungsinstrumentierung.The class defines an abstract class for management instrumentation.

Event Event Event Event 1

Die Klasse stellt Ereignisse für die Verwaltungsinstrumentierung bereit.The class provides events for management instrumentation.

Instance Instance Instance Instance 0

Die Klasse stellt Instanzen für die Verwaltungsinstrumentierung bereit.The class provides instances for management instrumentation.

Beispiele

Im folgenden Beispiel wird veranschaulicht, wie eine Verwaltungsereignisklasse mithilfe der InstrumentationType Enumeration.The following example demonstrates how to create a management event class by using the InstrumentationType enumeration.

using System;
using System.Management;
using System.Configuration.Install;
using System.Management.Instrumentation;

// This example demonstrates how to create
// a management event class by using
// the InstrumentationType enumeration

// Specify which namespace the management event
// class is created in
[assembly:Instrumented("Root/Default")]

// Let the system know you will run
// InstallUtil.exe tool against this assembly
[System.ComponentModel.RunInstaller(true)]
public class MyInstaller : 
    DefaultManagementProjectInstaller {}

namespace WMISample
{
    // Create a management instrumentation event class
    [InstrumentationClass(InstrumentationType.Event)]
    public class MyEvent
    {
        private string EventName;
        public void setEventName(string name)
        {
            EventName = name;
        }
    }

    public class WMIInstrumentedEventExample
    {
        public static void Main() 
        {
            MyEvent e = new MyEvent();
            e.setEventName("Hello");
        
            // Fire a management event
            Instrumentation.Fire(e);        
            return;
        }
    }
}
Imports System
Imports System.Management
Imports System.Configuration.Install
Imports System.Management.Instrumentation

' This sample demonstrates how to create
' a management event class by using
' the InstrumentationType enumeration

' Specify which namespace the management event
' class is created in
<Assembly: Instrumented("Root/Default")> 

' Let the system know InstallUtil.exe tool will
' be run against this assembly
<System.ComponentModel.RunInstaller(True)> _
Public Class MyInstaller
    Inherits DefaultManagementProjectInstaller
End Class 'MyInstaller

Namespace WMISample
    ' Create a management instrumentation event class
    <InstrumentationClass(InstrumentationType.Event)> _
    Public Class MyEvent
        Private EventName As String
        Function setEventName(ByVal name As String)
            EventName = name
        End Function
    End Class

    Public Class SampleEventProvider
        Public Shared Function Main(ByVal args() _
            As String) As Integer

            Dim e As New MyEvent
            e.setEventName("Hello")

            ' Fire a management event
            System.Management.Instrumentation. _
                Instrumentation.Fire(e)

            Return 0
        End Function
    End Class
End Namespace

Gilt für: