C# and API - newbie question

  • Thread starter Thread starter JSM
  • Start date Start date
J

JSM

Hi,

I am a VB programmer who is just starting to look at C#. Reading through
Microsoft's documentation they say how much more powerful .NET is and that
you don't have to reply as heavily on Win32 API calls as you did in VB.

One of the reasons for using API in VB was because it was a lot quicker then
using the VB equivalent (for example recursive file searching). I am
assuming that this is still the case with .NET. Am I correct? Should I still
opt for using Win32 API calls instead of .NET classes if speed is important?

Cheers,

John
 
The truth is that MS has wrapped a lot of API calls into C# functions and
made it internal to C#. A lot of Win functionality in VB was available only
through API's, i.e. there were no VB functions that would do these things.
You would have to declare an API function, reference Win DLL, etc. In C#,
there is a bunch of Win functions that you can call without actually
declaring an API function as you would do in VB, they are there in C#. There
are some cases in C# when you need to call a function from external DLL, but
it is a different story. I would not worry about the speed, MS optimized
these calls. That is the whole purpose of .NET framework, to make API's
calls available using convenient way of calling them. It is basically the
same as if in VB you did not have to declare an API function, but simply
call this function because it existed in VB.
 
Back
Top