I am trying to see the actual implementation detail of System.Management.ManagementDateTimeConverter.ToDateTime(string) using ILspy? It didn't show anything. Then I thought it's probably a bug in ILSpy and tried to see the decompiled code using Reflector - but it also doesn't show details (please see below code snippet) either.

Basically I am trying to see how the cim datetime will be parsed - for details, you may refer to: (What format is this time value in? , Parse CIM_DateTime to .Net DateTime )

Questions

  1. Why am I not able to see the decompiled code of this specific function/assembly?

  2. any details on how managementdatetimeconverter parses the stringof type 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)
{
}
2

There are 2 best solutions below

2
On BEST ANSWER

Thanks for all the comments - it helped me to find a way to see the implementation of ToDateTim(..) am looking for.

Visual Studio properties windows showing the system.management assembly location as 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Management.dll'. So, I have used this to reflect over to see the implementation.

Once I saw the above comments, which confirms its working for others, I tried to see which assembly has been loaded during runtime - Debug + Modules window showed that the assembly has been loaded from "C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Management\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Management.dll" - so reflecting over it showed that actual code.

0
On

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

Menu "File > Open from GAC..."