1

我正在尝试查看 System.Management 的实际实现细节。ManagementDateTimeConverter.ToDateTime(字符串)使用ILspy?它没有显示任何东西。然后我认为这可能是 ILSpy 中的一个错误,并尝试使用 Reflector 查看反编译的代码 - 但它也没有显示详细信息(请参阅下面的代码片段)。

基本上我想看看如何解析 cim 日期时间 - 有关详细信息,您可以参考:(这个时间值是什么格式?将 CIM_DateTime 解析为 .Net DateTime

问题

  1. 为什么我看不到这个特定函数/程序集的反编译代码?

  2. 有关 managementdatetimeconverter 如何解析 CIM DateTime 类型的字符串的任何详细信息?


// System.Management.ManagementDateTimeConverter
/// <summary>Converts a given DMTF datetime to <see cref="T:System.DateTime" />. The returned <see cref="T:System.DateTime" /> will be in the current time zone of the system.          </summary>
/// <returns>A <see cref="T:System.DateTime" /> that represents the given DMTF datetime.</returns>
/// <param name="dmtfDate">A string representing the datetime in DMTF format.</param>
public static DateTime ToDateTime(string dmtfDate)
{
}
4

2 回答 2

2

感谢所有快速评论 - 它帮助我找到了一种方法来查看 ToDateTim(..) 正在寻找的实现。

Visual Studio 属性窗口将 system.management 程序集位置显示为“C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5****System.Management.dll****”。所以,我用它来反思一下,看看实现。

一旦我看到上面的评论,确认它对其他人有效,我试图查看在运行时加载了哪个程序集 - 调试 + 模块窗口显示程序集已从“C:\Windows\Microsoft.Net\assembly\ GAC_MSIL\System.Management\v4.0_4.0.0.0__b03f5f7f11d50a3a**System.Management.dll**" - 因此反映它显示了实际代码。

Best Regards!

于 2014-06-06T23:31:21.133 回答
0

With ILSpy, you can also load the assembly from the GAC.

Menu "File > Open from GAC..."

于 2018-06-11T14:08:40.250 回答