1

I see DllImport everywhere. I see everybody declaring Win API methods in their projects. Why doesn't people put every Win API method declaration in a .NET library and use it instead? Is there any such library? Is it open source?

Jader Dias
  • 88,211
  • 155
  • 421
  • 625

2 Answers2

5

Because this would be a huge library, and no one needs to call all of the Win API methods.

The closest thing that I know of is pinvoke.net.

Many specific APIs have .NET wrappers, if you look around (ESENT, IIS management, SQL management and more).

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • See also the PInvoke Signature Generator tool: http://stackoverflow.com/questions/5122410/accessing-windows-api-constants-and-structs-for-p-invoke/5122534#5122534 – Mark Sowul Feb 28 '11 at 19:39
  • NET is a huge library. I doubt it would increase much in size if it included those wrappers. – Jader Dias Feb 28 '11 at 20:58
4

The WindowsAPICodePack comes close for many things.

Mark Sowul
  • 10,244
  • 1
  • 45
  • 51