【发布时间】:2011-06-02 17:53:18
【问题描述】:
为什么我在以下代码中找不到类型或命名空间名称'ManagementEventWatcher':
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Management;
class Program {
public ManagementEventWatcher mgmtWtch;
static void Main(string[] args)
{
InitializeComponent();
mgmtWtch = new System.Management
.ManagementEventWatcher("Select * From Win32_ProcessStartTrace");
mgmtWtch.EventArrived += new
System.Management.EventArrivedEventHandler(mgmtWtch_EventArrived);
mgmtWtch.Start();
}
}
我觉得我的dll没有这个方法,但是怎么检查呢?
【问题讨论】:
-
请重新表述问题。解释你到底在努力解决什么问题。
-
找不到类型或命名空间名称“ManagementEventWatcher”
-
您是否缺少程序集参考?看How to add the system.management.dll reference into a project的分步方式。