Click here to Skip to main content
15,896,726 members
Home / Discussions / C#
   

C#

 
Questioncompression Pin
mkl_0713-Jul-07 10:24
mkl_0713-Jul-07 10:24 
AnswerRe: compression Pin
Paul Conrad13-Jul-07 10:31
professionalPaul Conrad13-Jul-07 10:31 
Question[How] Screen reading for automation tasks? Pin
sbscb13-Jul-07 9:59
sbscb13-Jul-07 9:59 
AnswerRe: [How] Screen reading for automation tasks? Pin
Shy Agam13-Jul-07 11:08
Shy Agam13-Jul-07 11:08 
QuestionConcating strings... Pin
Shy Agam13-Jul-07 9:13
Shy Agam13-Jul-07 9:13 
AnswerRe: Concating strings... Pin
PIEBALDconsult13-Jul-07 9:32
mvePIEBALDconsult13-Jul-07 9:32 
AnswerRe: Concating strings... Pin
Guffa13-Jul-07 10:25
Guffa13-Jul-07 10:25 
AnswerRe: Concating strings... Pin
Luc Pattyn13-Jul-07 10:35
sitebuilderLuc Pattyn13-Jul-07 10:35 
Hi,

StringBuilder is very useful and efficient when it allows you to avoid a lot of
intermediate string objects. And it is best to create it with sufficient initial
capacity.

So instead of doing (silly example!):

string s="";
foreach (char c in "abcdefghijklmnopqrstuvwxyz") s=s+c;
Console.WriteLine(s);


which creates more than 20 string objects, you'd better do:

StringBuilder sb=new StringBuilder(100);  // large enough
foreach (char c in "abcdefghijklmnopqrstuvwxyz") sb.Append(c);
string s=sb.ToString();
Console.WriteLine(s);


which only creates one StringBuilder and one string.
Since the capacity is sufficient, sb will never need an internal extend-and-copy
(as in good old Basic Redim).

StringBuilder will not give you a more efficient way to do a simple
string3=string1+string2 tho.

Smile | :)









QuestionA query regarding deployment!!! Pin
haseebbutt00713-Jul-07 8:02
haseebbutt00713-Jul-07 8:02 
AnswerRe: A query regarding deployment!!! Pin
Dave Kreskowiak13-Jul-07 8:11
mveDave Kreskowiak13-Jul-07 8:11 
GeneralRe: A query regarding deployment!!! Pin
haseebbutt00713-Jul-07 8:42
haseebbutt00713-Jul-07 8:42 
GeneralRe: A query regarding deployment!!! Pin
Dave Kreskowiak13-Jul-07 8:57
mveDave Kreskowiak13-Jul-07 8:57 
GeneralRe: A query regarding deployment!!! Pin
Larantz13-Jul-07 23:15
Larantz13-Jul-07 23:15 
GeneralRegEx bug in .NET Framework!! Pin
Dominic Pettifer13-Jul-07 7:09
Dominic Pettifer13-Jul-07 7:09 
GeneralRe: RegEx bug in .NET Framework!! Pin
Judah Gabriel Himango13-Jul-07 7:43
sponsorJudah Gabriel Himango13-Jul-07 7:43 
GeneralRe: RegEx bug in .NET Framework!! Pin
Malcolm Smart13-Jul-07 10:34
Malcolm Smart13-Jul-07 10:34 
GeneralRe: RegEx bug in .NET Framework!! Pin
Scott Dorman13-Jul-07 10:54
professionalScott Dorman13-Jul-07 10:54 
GeneralRe: RegEx bug in .NET Framework!! Pin
Paul Conrad13-Jul-07 10:58
professionalPaul Conrad13-Jul-07 10:58 
GeneralRe: RegEx bug in .NET Framework!! Pin
Dan Neely13-Jul-07 11:02
Dan Neely13-Jul-07 11:02 
GeneralRe: RegEx bug in .NET Framework!! Pin
Paul Conrad13-Jul-07 11:35
professionalPaul Conrad13-Jul-07 11:35 
GeneralRe: RegEx bug in .NET Framework!! Pin
Judah Gabriel Himango13-Jul-07 11:22
sponsorJudah Gabriel Himango13-Jul-07 11:22 
GeneralRe: RegEx bug in .NET Framework!! Pin
Paul Conrad13-Jul-07 11:38
professionalPaul Conrad13-Jul-07 11:38 
GeneralRe: RegEx bug in .NET Framework!! Pin
Michael Sync13-Jul-07 21:18
Michael Sync13-Jul-07 21:18 
QuestionMySQL inserting UnicodeStr Pin
pnpfriend13-Jul-07 6:48
pnpfriend13-Jul-07 6:48 
AnswerRe: MySQL inserting UnicodeStr Pin
Giorgi Dalakishvili13-Jul-07 7:03
mentorGiorgi Dalakishvili13-Jul-07 7:03 

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.