Results 1 to 4 of 4

Thread: StringBuilder vs String ?

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    StringBuilder vs String ?

    I'm using stringbuilder instead string (for critical performance issue) . Anyway , in this for loop ,
    am I creating string objects(with the bolded font each time I call this line :

    Code:
    SplitedFilWriteStream = File.Create(Path.Combine(OutputPath ,FileNameOnly+segName[nSegmentCount-1].ToString() ));

    The for loop looks like this :

    PHP Code:
    for (nSegmentCount =1nSegmentCount <=nSegments_CompletetBuffered;nSegmentCount++)
        {
    segName.Append(nSegmentCount);    
    SplitedFilWriteStream File.Create(Path.Combine(OutputPath ,FileNameOnly+segName[nSegmentCount-1].ToString()));
    SegmentTotal += 1
    Last edited by Pirate; Nov 27th, 2004 at 08:42 PM.

  2. #2

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    bump or pumb if it helps....

  3. #3
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Yes. Well, you're not creating the string object, but the .ToString() method would be. At least I think so Documentation doesn't actually specify that, but I guess that's the way it would have to be.

    Would be interesting to decompile and see exactly what it's doing.

  4. #4

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Mike Hildner
    Yes. Well, you're not creating the string object, but the .ToString() method would be. At least I think so Documentation doesn't actually specify that, but I guess that's the way it would have to be.

    Would be interesting to decompile and see exactly what it's doing.
    Thanks , it sounds great idea . I agree with you for the ToString() function part which explains how strings are unchangable objs so they create new string objs everytime they get changed . This is what I understood from MSDN help .

    I must try this and I'll tell you how it goes ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width