Click here to Skip to main content
15,885,767 members
Home / Discussions / C#
   

C#

 
GeneralRe: creat a directory ? Pin
David Stone22-Oct-02 10:20
sitebuilderDavid Stone22-Oct-02 10:20 
GeneralRe: creat a directory ? Pin
James T. Johnson23-Oct-02 17:02
James T. Johnson23-Oct-02 17:02 
GeneralRe: creat a directory ? Pin
David Stone23-Oct-02 17:25
sitebuilderDavid Stone23-Oct-02 17:25 
GeneralRe: creat a directory ? Pin
leppie22-Oct-02 11:35
leppie22-Oct-02 11:35 
GeneralRe: creat a directory ? Pin
David Stone23-Oct-02 16:38
sitebuilderDavid Stone23-Oct-02 16:38 
GeneralRe: creat a directory ? Pin
leppie24-Oct-02 7:23
leppie24-Oct-02 7:23 
QuestionLogOn Tab, and check the "allow service to interact with desktop".? Pin
imran_rafique21-Oct-02 15:12
imran_rafique21-Oct-02 15:12 
GeneralIO Performance Question Pin
Chris Austin21-Oct-02 13:47
Chris Austin21-Oct-02 13: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 10:54
Ed K21-Oct-02 10:54 
GeneralRe: ResponseXML doesn't get it! Pin
Stephane Rodriguez.22-Oct-02 1:52
Stephane Rodriguez.22-Oct-02 1:52 
GeneralProgrammer boards links Pin
gicio21-Oct-02 9:10
gicio21-Oct-02 9:10 
GeneralRe: Programmer boards links Pin
Daniel Turini21-Oct-02 13:55
Daniel Turini21-Oct-02 13:55 
GeneralRe: Programmer boards links Pin
gicio22-Oct-02 1:28
gicio22-Oct-02 1:28 
QuestionConnecting to a FTP with C#??? Pin
gicio21-Oct-02 8:38
gicio21-Oct-02 8:38 
AnswerRe: Connecting to a FTP with C#??? Pin
David Stone21-Oct-02 8:46
sitebuilderDavid Stone21-Oct-02 8:46 
GeneralRe: Connecting to a FTP with C#??? Pin
Jon Rista23-Oct-02 18:14
Jon Rista23-Oct-02 18:14 
Questiona service? Pin
imran_rafique20-Oct-02 16:08
imran_rafique20-Oct-02 16:08 
AnswerRe: a service? Pin
Stephane Rodriguez.20-Oct-02 23:46
Stephane Rodriguez.20-Oct-02 23:46 
GeneralRe: a service? Pin
imran_rafique21-Oct-02 14:38
imran_rafique21-Oct-02 14:38 
GeneralRe: a service? Pin
imran_rafique21-Oct-02 15:20
imran_rafique21-Oct-02 15:20 
GeneralRe: a service? Pin
Stephane Rodriguez.22-Oct-02 1:51
Stephane Rodriguez.22-Oct-02 1:51 
GeneralRe: a service? Pin
imran_rafique22-Oct-02 15:21
imran_rafique22-Oct-02 15:21 
GeneralRe: a service? Pin
Stephane Rodriguez.22-Oct-02 18:57
Stephane Rodriguez.22-Oct-02 18:57 
GeneralRe: a service? Pin
imran_rafique23-Oct-02 16:07
imran_rafique23-Oct-02 16:07 
GeneralRe: a service? Pin
Stephane Rodriguez.23-Oct-02 20:11
Stephane Rodriguez.23-Oct-02 20: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.