In other words, does the .NET framework eventually make calls somewhere to get its work done? Or did Microsoft completely re-create all the functionality of the win32 library in their .NET framework.
Thanks!
It is a mix. Obviously, things like winforms are largely wrappers around Win32 functionality (or a mix of both worlds), but WPF is a lot more managed (in terms of the actual control code; under the hood, as Mash notes, it may use DirectX for the rendering). Likewise, things like file/network access are (by necessity) wrappers around the OS objects, as are the unmanaged lock objects like Mutex
- but many other things are 100% managed.
So it isn't a simple answer.
(edit) Also - keep in mind that ".NET" is a very vague term; Compact Framework, Micro Framework, Silverlight etc may have different, non-win32 implementations.
Update: realised I answered the wrong question (you said runtime not class library)...oh well I'll keep the guff below in anyway!
It depends on the part of the library:
That's just from fiddling with Reflector. Obviously being a COM server the Microsoft CLR relies heavily on win32 too.
A .NET application is just another Win32 process, so there is no magic and obviously it is going to use the underline operating system. Even the .NET libraries use Win32 to a great extent.
Examples:
Memory management is handled internally for managed code, but for the process itself it is handled just like any other Win32 process.
Currently managed threads are implemented as OS threads as well.
In some cases (most, perhaps? I haven't reflected through the entire framework) the .NET framework makes calls to win32. Most controls are simply win32-controls wrapped with a few new features.
Yes, it calls win32 functions internally. For example the OpenRead method in File class contains:
return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
and it will eventually call:
SafeFileHandle handle = CreateFile(lpFileName, dwDesiredAccess, dwShareMode, securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
which is a win32 native function, deep down in the method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With