Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How much does the .NET Framework rely on the Windows API?

I know some of the .NET Framework library (FCL) wraps Windows API calls, but I don't know how much. All of it? Most of it? Only a little bit?

Let's say I write a typical winforms business application in C# using only managed code. How much of my "managed" application is really "unmanaged" under the covers?

like image 840
Igby Largeman Avatar asked Jan 19 '26 20:01

Igby Largeman


1 Answers

Let's say I write a typical winforms business application in C# using only managed code. How much of my "managed" application is really "unmanaged" under the covers?

In Windows Forms, nearly everything is a thin wrapper over a managed Windows API. Windows Forms Controls even expose their native control handle via the Handle property.

That being said, if you use WPF, for example, much more of the underlying logic was written in managed code. At some level, of course, things always shell out to the operating system - but much of the framework (WPF, WCF, etc) is higher level abstractions written in managed code, built on top of the lower level wrappers around the native API.

That being said, the level of managed code vs. native core varies greatly, depending on the type in question. The beauty of this, though, is that, with .NET, you really don't have to care about whether the underlying implementation is native or managed, only whether it's a resource which requires cleanup via IDisposable or similar.

like image 60
Reed Copsey Avatar answered Jan 21 '26 13:01

Reed Copsey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!