.NET API Question

D

Don Beal

I am new to .NET but have a lot of experience in VB (v 3+).

I have an application that deals with thousands of files and working
with VB .NET I see the dir function. In the past I have stayed away
from the VB6 DIR function in favor of the API calls.

Do I still use API calls in the same way as I did in previous versions
of VB or is it now best to use the built in functions? I am asking
purely from a performance standpoint.

Thanks for your replies.

Don Beal
 
P

Pieter Philippaerts

Don Beal said:
Do I still use API calls in the same way as I did in previous versions
of VB or is it now best to use the built in functions? I am asking
purely from a performance standpoint.

You should use the methods from the Base Class Library. In your case, take a
look at the classes under the System.IO namespace [Directory, DirectoryInfo,
File, FileInfo, etc].

Regards,
Pieter Philippaerts
Managed SSL/TLS: http://www.mentalis.org/go.php?sl
 
H

Herfried K. Wagner [MVP]

Don Beal said:
I have an application that deals with thousands of files
and working with VB .NET I see the dir function. In
the past I have stayed away from the VB6 DIR function in
favor of the API calls.

Do I still use API calls in the same way as I did in
previous versions of VB or is it now best to use the
built in functions? I am asking purely from a
performance standpoint.

Have a look at the classes provided in the 'System.IO' namespace
('Directory', 'File', 'DirectoryInfo', 'FileInfo', ...).
 
D

David Faircastle

Hi there,

The Dir function calls the .NET classes which in turn call the OS. The
best way to determine the cost of these wrappings is to write and time the
different versions. If you do this, it would be very interesting if you were
to post back your results. :)

Have a look at PerformanceCounters if you want to do the most accurate
measurements. There's a utility, PerfMon.exe which will let you examine them.
Within VS, if you have the Server Explorer, you can get another view of the
list under the node for your machine.

DF
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top