I tried to use the Dispose method for XmlReader , but it seems to be unavailable. After browsing the Internet, I found out that in .Net 2.0 the IDisposable.Dispose method was implemented explicitly, but this was fixed in .Net 4.0. Indeed, when I tested the method with .Net Reflector, it was publicly published.
But although my project used .Net 4.0 as the target structure, I still could not call the Dispose method without explicitly XmlReader in IDisposable.
Then I noticed that .Net Reflector decompiled C:\Windows\Microsoft.net\Framework\v4.0.30319\System.Xml.dll , while my project used C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll as a reference. I decompiled the latter, and indeed, the Dispose method is still implemented explicitly in this.
Why are there two different versions of the same DLL for the same version of the framework?
Is it possible to configure Visual Studio 2010 to use C:\Windows\Microsoft.net\Framework\v4.0.30319\ instead of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 when referring to the framework ?
PS I have not installed .Net 4.5 infrastructure yet.
source share