次の方法で共有


InstrumentationType 列挙体

クラスが提供する実装の種類を指定します。

<Serializable>
Public Enum InstrumentationType
[C#]
[Serializable]
public enum InstrumentationType
[C++]
[Serializable]
__value public enum InstrumentationType
[JScript]
public
   Serializable
enum InstrumentationType

メンバ

メンバ名 説明
Abstract クラスが管理実装のために抽象クラスを定義することを指定します。
Event クラスが管理実装のためにイベントを提供することを指定します。
Instance クラスが管理実装のためにインスタンスを提供することを指定します。

使用例

 
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 InstrumentationClass attribute and to fire a Management Event from
// managed code.

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

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

// Create a Management Instrumentation Event class
[InstrumentationClass(InstrumentationType.Event)]
public class MyEvent
{
    public string EventName;
}

public class WMI_InstrumentedEvent_Example
{
    public static void Main() {
        MyEvent e = new MyEvent();
        e.EventName = "Hello";
        
        // Fire a Management Event
        Instrumentation.Fire(e);
        
        return;
    }
}
   
[Visual Basic] 
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 InstrumentationClass attribute and to fire a Management Event from
' managed code.

' Specify which namespace the Manaegment Event class is created in
<assembly: Instrumented("Root/Default")>

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

' Create a Management Instrumentation Event class
<InstrumentationClass(InstrumentationType.Event)> _ 
Public Class MyEvent
    Public EventName As String
End Class

Public Class Sample_EventProvider
    Public Shared Function Main(args() As String) As Integer
        Dim e As New MyEvent()
        e.EventName = "Hello"
        
        ' Fire a Management Event
        Instrumentation.Fire(e)
        
        Return 0
    End Function
End Class
   

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

名前空間: System.Management.Instrumentation

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

アセンブリ: System.Management (System.Management.dll 内)

参照

System.Management.Instrumentation 名前空間