There are many instances of PInvoke that simply call the Win32 API. However, there is some functionality that is implemented in the CLR itself (for example, locking operations). If you want to see how this is done, look at the rotor .
In a detailed explanation of blocking (viewing the source of the rotor) in this blog post.
To answer your question, you need to get all the .NET source code (for example, use NetMassDownloader and grep for a string that says "InternalCall" or "DllImport") and compare this with the number of all lines. Perhaps you could multiply each of these โunmanagedโ lines by some factor to guess, or you would have to plunge into the rotor or the Windows source code to get the actual numbers. If you have traveled so far, then everything will become fuzzy (for example, if File.Open calls Win32 CreateFile, should I use CreateFile for .NET? I think not). So, at best, you only multiply "InternalCall" by some factor to guess.
source share