System.Management 10.0.1
About
Provides access to a rich set of management information and management events about the system, devices, and applications instrumented to the Windows Management Instrumentation (WMI) infrastructure. Not supported on other platforms.
Key Features
- Consume Windows Management Instrumentation (WMI) data and events
- High performance extensible event mechanism
How to Use
Retrieve management information
using System.Management;
// Get the WMI class
ManagementClass managementClass = new("Win32_Processor");
// Loop through the WMI class instances and print the processor information found
foreach (ManagementObject managementObject in managementClass.GetInstances())
{
Console.WriteLine("--- Processor information ---");
Console.WriteLine($"Name: {managementObject["Name"]}");
Console.WriteLine($"Architecture: {managementObject["Architecture"]}");
}
Query management information via the SelectQuery type
using System.Management;
// Search for win32 services with a stopped state
SelectQuery selectQuery = new("Win32_Service", "State = 'Stopped'");
ManagementObjectSearcher managementObjectSearcher = new(selectQuery);
foreach (ManagementObject service in managementObjectSearcher.Get())
{
Console.WriteLine(service.ToString());
}
Main Types
The main types provided by this library are:
System.Management.ManagementClassSystem.Management.ManagementObjectSystem.Management.SelectQuery
Additional Documentation
- Conceptual documentation
- System.Management API documentation
- System.Management.ManagementClass documentation
Feedback & Contributing
System.Management is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Showing the top 20 packages that depend on System.Management.
| Packages | Downloads |
|---|---|
|
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,Excel简单导出,权重随机筛选算法,分布式短id,表达式树,linq扩展,文件压缩,多线程下载和FTP客户端,硬件信息,字符串扩展方法,日期时间扩展操作,中国农历,大文件拷贝,图像裁剪,验证码,断点续传,集合扩展等常用封装。
官网教程:https://ldqk.org/55
github:https://github.com/ldqk/Masuit.Tools
|
1 |
|
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。
官网教程:https://masuit.com/55
github:https://github.com/ldqk/Masuit.Tools
|
1 |
|
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。
官网教程:https://masuit.com/55
github:https://github.com/ldqk/Masuit.Tools
|
1 |
|
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。
官网教程:https://masuit.com/55
github:https://github.com/ldqk/Masuit.Tools
|
1 |
|
Masuit.Tools.Core
包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。
示例代码:
1.检验字符串是否是Email
bool isEmail="1170397736@qq.com".MatchEmail();
2.大文件操作
FileStream fs = new FileStream(@"D:\boot.vmdk", FileMode.OpenOrCreate, FileAccess.ReadWrite);
{
//fs.CopyToFile(@"D:\1.bak");//同步复制大文件
fs.CopyToFileAsync(@"D:\1.bak");//异步复制大文件
string md5 = fs.GetFileMD5Async().Result;//异步获取文件的MD5
}
3.html的防XSS处理:
string html = @"<link href='/Content/font-awesome/css' rel='stylesheet'/>
<!--[if IE 7]>
<link href='/Content/font-awesome-ie7.min.css' rel='stylesheet'/>
<![endif]-->
<script src='/Scripts/modernizr'></script>
<div id='searchBox' role='search'>
<form action='/packages' method='get'>
<span class='user-actions'><a href='/users/account/LogOff'>退出</a></span>
<input name='q' id='searchBoxInput'/>
<input id='searchBoxSubmit' type='submit' value='Submit' />
</form>
</div>";
string s = html.HtmlSantinizerStandard();//清理后:<div><span><a href="/users/account/LogOff">退出</a></span></div>
......
|
1 |
.NET 8.0
- System.CodeDom (>= 10.0.1)
.NET 9.0
- System.CodeDom (>= 10.0.1)
.NET 10.0
- System.CodeDom (>= 10.0.1)
.NET Standard 2.0
- System.CodeDom (>= 10.0.1)