Click here to Skip to main content
15,881,877 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Windows.Forms control in www Pin
Nick Parker23-Oct-02 12:55
protectorNick Parker23-Oct-02 12:55 
GeneralRe: Windows.Forms control in www Pin
James T. Johnson23-Oct-02 13:34
James T. Johnson23-Oct-02 13:34 
GeneralRe: Windows.Forms control in www Pin
Tomas Petricek23-Oct-02 14:05
Tomas Petricek23-Oct-02 14:05 
GeneralRe: Windows.Forms control in www Pin
Tomas Petricek24-Oct-02 13:32
Tomas Petricek24-Oct-02 13:32 
GeneralRe: Windows.Forms control in www Pin
Victor Vogelpoel19-Feb-03 3:31
Victor Vogelpoel19-Feb-03 3:31 
GeneralToolboxBitmap Attribute Pin
Derek Lakin22-Oct-02 23:34
Derek Lakin22-Oct-02 23:34 
GeneralRe: ToolboxBitmap Attribute Pin
Derek Lakin23-Oct-02 1:15
Derek Lakin23-Oct-02 1:15 
GeneralIO Performance Question Pin
Chris Austin21-Oct-02 17:23
Chris Austin21-Oct-02 17:23 
Hey Folks,

I initaly posted this in the C# group but realised that this may be more appropiate here.

I have a few old (very handy) programs that I have written using perl and python that I want to port to C# just for the sake of doing it.

In one of the instances, I need to enumorate across a directory and get the the total size of the files in the directory. Using a simple "foreach" loop like:
<br />
long total = 0;<br />
...<br />
...<br />
foreach(FileInfo f in directory.GetFiles())<br />
{<br />
total += f.Lenght;<br />
}<br />
...<br />
...<br />

And I have to say that this is SLOW. When recursing medium to large directories it can take as much as 10x the time my perl and python programs take.

My guess is that it is due to fact that the call to the Length property is not so light-weight as one might think. So, the call inside the loop is killing me.

Has anybody else ran into this hiccup?

And, does anybody have any suggestions about how to design around this?

Any help would be appreciated

Many Thanks


Chris
GeneralGetting free disk space Pin
Arash Sabet21-Oct-02 4:39
Arash Sabet21-Oct-02 4:39 
GeneralRe: Getting free disk space Pin
Stephane Rodriguez.21-Oct-02 5:00
Stephane Rodriguez.21-Oct-02 5:00 
GeneralDateTimePicker Pin
Derek Lakin21-Oct-02 4:21
Derek Lakin21-Oct-02 4:21 
GeneralRe: DateTimePicker Pin
leppie21-Oct-02 7:59
leppie21-Oct-02 7:59 
GeneralRe: DateTimePicker Pin
Derek Lakin21-Oct-02 21:43
Derek Lakin21-Oct-02 21:43 
GeneralRe: DateTimePicker Pin
leppie1-Nov-02 8:34
leppie1-Nov-02 8:34 
GeneralRe: DateTimePicker Pin
Richard Deeming22-Oct-02 1:51
mveRichard Deeming22-Oct-02 1:51 
GeneralRe: DateTimePicker Pin
Richard Deeming22-Oct-02 2:24
mveRichard Deeming22-Oct-02 2:24 
GeneralRe: DateTimePicker Pin
Derek Lakin22-Oct-02 2:37
Derek Lakin22-Oct-02 2:37 
GeneralRe: DateTimePicker Pin
Derek Lakin29-Oct-02 0:10
Derek Lakin29-Oct-02 0:10 
GeneralRe: DateTimePicker Pin
Richard Deeming29-Oct-02 1:59
mveRichard Deeming29-Oct-02 1:59 
GeneralData Binding and Windows Forms Pin
Derek Lakin17-Oct-02 23:41
Derek Lakin17-Oct-02 23:41 
GeneralUploaded Files Get Locked for ~ 30 seconds Pin
Angus Logan17-Oct-02 19:24
Angus Logan17-Oct-02 19:24 
GeneralRe: Uploaded Files Get Locked for ~ 30 seconds Pin
Vasudevan Deepak Kumar29-Oct-02 2:26
Vasudevan Deepak Kumar29-Oct-02 2:26 
GeneralSalamander .NET Protector Pin
Patrick Lassalle17-Oct-02 1:57
Patrick Lassalle17-Oct-02 1:57 
GeneralRe: Salamander .NET Protector Pin
Derek Lakin17-Oct-02 23:43
Derek Lakin17-Oct-02 23:43 
GeneralRe: Salamander .NET Protector Pin
Patrick Lassalle17-Oct-02 23:47
Patrick Lassalle17-Oct-02 23:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.