Click here to Skip to main content
15,569,745 members
Home / Discussions / C#
   

C#

 
GeneralRe: creat a directory ? Pin
David Stone22-Oct-02 11:20
sitebuilderDavid Stone22-Oct-02 11:20 
GeneralRe: creat a directory ? Pin
James T. Johnson23-Oct-02 18:02
James T. Johnson23-Oct-02 18:02 
GeneralRe: creat a directory ? Pin
David Stone23-Oct-02 18:25
sitebuilderDavid Stone23-Oct-02 18:25 
GeneralRe: creat a directory ? Pin
leppie22-Oct-02 12:35
leppie22-Oct-02 12:35 
GeneralRe: creat a directory ? Pin
David Stone23-Oct-02 17:38
sitebuilderDavid Stone23-Oct-02 17:38 
GeneralRe: creat a directory ? Pin
leppie24-Oct-02 8:23
leppie24-Oct-02 8:23 
QuestionLogOn Tab, and check the "allow service to interact with desktop".? Pin
imran_rafique21-Oct-02 16:12
imran_rafique21-Oct-02 16:12 
GeneralIO Performance Question Pin
Chris Austin21-Oct-02 14:47
Chris Austin21-Oct-02 14:47 
Hey Folks,

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
GeneralResponseXML doesn't get it! Pin
Ed K21-Oct-02 11:54
Ed K21-Oct-02 11:54 
GeneralRe: ResponseXML doesn't get it! Pin
Stephane Rodriguez.22-Oct-02 2:52
Stephane Rodriguez.22-Oct-02 2:52 
GeneralProgrammer boards links Pin
gicio21-Oct-02 10:10
gicio21-Oct-02 10:10 
GeneralRe: Programmer boards links Pin
Daniel Turini21-Oct-02 14:55
Daniel Turini21-Oct-02 14:55 
GeneralRe: Programmer boards links Pin
gicio22-Oct-02 2:28
gicio22-Oct-02 2:28 
QuestionConnecting to a FTP with C#??? Pin
gicio21-Oct-02 9:38
gicio21-Oct-02 9:38 
AnswerRe: Connecting to a FTP with C#??? Pin
David Stone21-Oct-02 9:46
sitebuilderDavid Stone21-Oct-02 9:46 
GeneralRe: Connecting to a FTP with C#??? Pin
Jon Rista23-Oct-02 19:14
Jon Rista23-Oct-02 19:14 
Questiona service? Pin
imran_rafique20-Oct-02 17:08
imran_rafique20-Oct-02 17:08 
AnswerRe: a service? Pin
Stephane Rodriguez.21-Oct-02 0:46
Stephane Rodriguez.21-Oct-02 0:46 
GeneralRe: a service? Pin
imran_rafique21-Oct-02 15:38
imran_rafique21-Oct-02 15:38 
GeneralRe: a service? Pin
imran_rafique21-Oct-02 16:20
imran_rafique21-Oct-02 16:20 
GeneralRe: a service? Pin
Stephane Rodriguez.22-Oct-02 2:51
Stephane Rodriguez.22-Oct-02 2:51 
GeneralRe: a service? Pin
imran_rafique22-Oct-02 16:21
imran_rafique22-Oct-02 16:21 
GeneralRe: a service? Pin
Stephane Rodriguez.22-Oct-02 19:57
Stephane Rodriguez.22-Oct-02 19:57 
GeneralRe: a service? Pin
imran_rafique23-Oct-02 17:07
imran_rafique23-Oct-02 17:07 
GeneralRe: a service? Pin
Stephane Rodriguez.23-Oct-02 21:11
Stephane Rodriguez.23-Oct-02 21:11 

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.