อ่านในภาษาอังกฤษ แก้ไข

แชร์ผ่าน


InstrumentationType Enum

Definition

Specifies the type of instrumentation provided by a class.

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. The MI APIs should be used for all new development.

C#
public enum InstrumentationType
Inheritance
InstrumentationType

Fields

Name Value Description
Instance 0

The class provides instances for management instrumentation.

Event 1

The class provides events for management instrumentation.

Abstract 2

The class defines an abstract class for management instrumentation.

Examples

The following example demonstrates how to create a management event class by using the InstrumentationType enumeration.

C#
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;
        }
    }
}

Applies to

ผลิตภัณฑ์ เวอร์ชัน
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1