-
Dec 10th, 2007, 05:15 PM
#1
Thread Starter
Interweb adm/o/distrator
[RESOLVED] API in VB.NET
Hi MSVB Team i was just wondering what you all thought about the use of API in almost any .NET language but VB.NET more specifically. I find that a lot of stuff can be done with the .NET library instead of using API, is it generally best to use the .NET libraries when it is applicable to do so?
Thanks Paul M
-
Dec 10th, 2007, 07:06 PM
#2
Special Guest - Microsoft
Re: API in VB.NET
Hi - could you please clarify what you mean by API vs. .NET library (using some examples)? Are you specifically refering to API features in the VB runtime like MsgBox(), CInt, Left(), etc?
-
Dec 11th, 2007, 01:38 AM
#3
Thread Starter
Interweb adm/o/distrator
Re: API in VB.NET
Sorry about that i was in a rush to get to work
Anyway i mean like in general would it be better especially performance wise to use the appropriate .NET library over API?
For example checking if a user has administrator privileges, would it be better to use the System.Principal library or to use API directly to determine this?
Sorry it is a very broad question but would you suggest using the .NET libraries over API when it is possible to do so?
-
Dec 11th, 2007, 01:40 AM
#4
Thread Starter
Interweb adm/o/distrator
Re: API in VB.NET
Sorry the System.Security.Prinicpal library.
-
Dec 11th, 2007, 01:55 AM
#5
Re: API in VB.NET
By "API" I'm guessing Paul means the Windows API via PInvoke, yes?
-
Dec 11th, 2007, 02:03 AM
#6
Thread Starter
Interweb adm/o/distrator
Re: API in VB.NET
Originally Posted by jmcilhinney
By "API" I'm guessing Paul means the Windows API via PInvoke, yes?
Yes
-
Dec 11th, 2007, 11:21 AM
#7
Special Guest - Microsoft
Re: API in VB.NET
In general if the API is available via .Net I would choose that over a PInvoke version. PInvoke is complex and has a lot of dark corners. When a .Net wrapper is produced that exposes these API's, generally the author has done the work to get it right and it should be easier to consume.
-
Dec 11th, 2007, 01:01 PM
#8
Frenzied Member
Re: API in VB.NET
It would be a wrapper and would add an extra layer that might be a bit slower.
I'll Be Back!
T-1000
Microsoft .Net 2005
Microsoft Visual Basic 6
Prefer using API
-
Dec 11th, 2007, 01:50 PM
#9
Special Guest - Microsoft
Re: API in VB.NET
In general I always prefer the .NET managed libraries over the Windows API. They are usually much cleaner, easier to use and faster to program. Only when they do not provide the functionality I need then I drop down to call the API directly. In the types of .NET applications I have built over the years (information systems) I have never noticed a performance penalty for using managed wrappers. My performance concerns lay elsewhere -- like database query times and network serialization ;-). It all depends on the types of applications you are writing.
HTH,
-B
-
Dec 11th, 2007, 02:26 PM
#10
Re: API in VB.NET
Every Operating System API call you use binds you to that particular OS more tightly. That is pretty much the reverse of what .net is all about - cross platform working.
I don't live here any more.
-
Dec 11th, 2007, 05:09 PM
#11
Thread Starter
Interweb adm/o/distrator
Re: API in VB.NET
Thanks guys, i always use the .NET libraries over API and sounds like i will continue
-
Dec 11th, 2007, 05:12 PM
#12
Re: [RESOLVED] API in VB.NET
The entire .NET Framework library is really just a wrapper. If you're not going to use it all the time you can then why use it at all? Assume that you should always use a managed type and/or member if one is available unless you have a specific reason for doing otherwise.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|