Click here to Skip to main content
16,018,460 members
Home / Discussions / C#
   

C#

 
AnswerRe: StringBuilder Pin
Scott Dorman22-Aug-07 7:23
professionalScott Dorman22-Aug-07 7:23 
GeneralRe: StringBuilder Pin
Giorgi Dalakishvili22-Aug-07 7:41
mentorGiorgi Dalakishvili22-Aug-07 7:41 
GeneralRe: StringBuilder Pin
Scott Dorman22-Aug-07 8:01
professionalScott Dorman22-Aug-07 8:01 
GeneralRe: StringBuilder Pin
PIEBALDconsult22-Aug-07 8:05
mvePIEBALDconsult22-Aug-07 8:05 
GeneralRe: StringBuilder Pin
Scott Dorman22-Aug-07 8:13
professionalScott Dorman22-Aug-07 8:13 
GeneralRe: StringBuilder Pin
PIEBALDconsult22-Aug-07 9:08
mvePIEBALDconsult22-Aug-07 9:08 
GeneralRe: StringBuilder Pin
Giorgi Dalakishvili22-Aug-07 9:23
mentorGiorgi Dalakishvili22-Aug-07 9:23 
GeneralRe: StringBuilder Pin
PIEBALDconsult22-Aug-07 10:00
mvePIEBALDconsult22-Aug-07 10:00 
For example:

Just yesterday I was working on a simple program that reads a C Sharp source file line-by-line then checks and corrects the indentation and such.

After reading a line, I put it in a StringBuilder, then I do things like:

C#
theline.Replace ( '\t' , ' ' ) ;

switch ( theline [ 0 ] ) { ... }

if ( theline [ 1 ] != ' ' ) { ... }


What I dislike about the StringBuilder (as implemented in .net 2 and earlier anyway), is:

A) There is no Clear() method, so I use theline.Remove ( 0 , theline.Length ) ;

B) There is no way to Set the string (after instantiation) other than Append()

Which means I have to use:

C#
while ( ( inline = Infile.ReadLine() ) != null )
{
    theline.Remove ( 0 , theline.Length ) ;
    theline.Append ( inline ) ;
    ...
}



If anyone else has a better technique, pleast let me know.

(Does the .net 3 version have more functionality? I'd better check.)
GeneralRe: StringBuilder Pin
Luc Pattyn22-Aug-07 13:21
sitebuilderLuc Pattyn22-Aug-07 13:21 
GeneralRe: StringBuilder Pin
PIEBALDconsult22-Aug-07 14:43
mvePIEBALDconsult22-Aug-07 14:43 
GeneralRe: StringBuilder Pin
Luc Pattyn22-Aug-07 14:55
sitebuilderLuc Pattyn22-Aug-07 14:55 
GeneralRe: StringBuilder Pin
PIEBALDconsult22-Aug-07 17:57
mvePIEBALDconsult22-Aug-07 17:57 
QuestionRecording movement on a GUI of an application Pin
thedavejay22-Aug-07 6:27
thedavejay22-Aug-07 6:27 
AnswerRe: Recording movement on a GUI of an application Pin
Ravi Bhavnani22-Aug-07 10:46
professionalRavi Bhavnani22-Aug-07 10:46 
GeneralRe: Recording movement on a GUI of an application Pin
thedavejay23-Aug-07 6:32
thedavejay23-Aug-07 6:32 
QuestionDatagrid Pin
Brother Louis22-Aug-07 6:08
Brother Louis22-Aug-07 6:08 
Questionfrom CheckedListBox to DataGrid Pin
costavo22-Aug-07 4:55
costavo22-Aug-07 4:55 
AnswerRe: from CheckedListBox to DataGrid Pin
Vasudevan Deepak Kumar22-Aug-07 4:57
Vasudevan Deepak Kumar22-Aug-07 4:57 
GeneralRe: from CheckedListBox to DataGrid Pin
costavo22-Aug-07 6:10
costavo22-Aug-07 6:10 
QuestionDatagrid Pin
Brother Louis22-Aug-07 4:53
Brother Louis22-Aug-07 4:53 
AnswerRe: Datagrid Pin
Vasudevan Deepak Kumar22-Aug-07 4:55
Vasudevan Deepak Kumar22-Aug-07 4:55 
GeneralRe: Datagrid Pin
Brother Louis22-Aug-07 5:03
Brother Louis22-Aug-07 5:03 
QuestionUsing FileStream Pin
gauthee22-Aug-07 4:48
gauthee22-Aug-07 4:48 
AnswerRe: Using FileStream Pin
Vasudevan Deepak Kumar22-Aug-07 4:57
Vasudevan Deepak Kumar22-Aug-07 4:57 
GeneralRe: Using FileStream Pin
gauthee22-Aug-07 5:05
gauthee22-Aug-07 5:05 

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.