InstrumentationType 열거형

정의

클래스에서 제공하는 계측 형식을 지정합니다.

참고: WMI .NET 라이브러리는 이제 최종 상태로 간주되며 이러한 라이브러리에 영향을 주는 보안 관련 문제에 대해 추가 개발, 개선 기능 또는 업데이트를 사용할 수 없습니다. MI API는 모든 새 개발에 사용해야 합니다.

public enum class InstrumentationType
public enum InstrumentationType
type InstrumentationType = 
Public Enum InstrumentationType
상속
InstrumentationType

필드

Abstract 2

이 클래스는 관리 계측에 대한 추상 클래스를 정의합니다.

Event 1

이 클래스는 관리 계측에 대한 이벤트를 제공합니다.

Instance 0

이 클래스는 관리 계측에 대한 인스턴스를 제공합니다.

예제

다음 예제에 사용 하 여 관리 이벤트 클래스를 만드는 방법을 보여 줍니다는 InstrumentationType 열거형입니다.

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.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

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

적용 대상