Click here to Skip to main content
15,898,222 members
Home / Discussions / C#
   

C#

 
GeneralRe: Data Link Property Pin
Husein22-Nov-03 0:21
Husein22-Nov-03 0:21 
QuestionHow can I overdraw the titlebar? Pin
icysky9-Nov-03 13:44
icysky9-Nov-03 13:44 
QuestionWhen exactly should a StringBuilder be used? Pin
gicio9-Nov-03 10:48
gicio9-Nov-03 10:48 
AnswerRe: When exactly should a StringBuilder be used? Pin
J. Dunlap9-Nov-03 11:11
J. Dunlap9-Nov-03 11:11 
AnswerRe: When exactly should a StringBuilder be used? Pin
Nick Parker9-Nov-03 11:17
protectorNick Parker9-Nov-03 11:17 
AnswerRe: When exactly should a StringBuilder be used? Pin
Colin Angus Mackay9-Nov-03 13:59
Colin Angus Mackay9-Nov-03 13:59 
Generalone simple way to look at it Pin
CillyMe10-Nov-03 5:49
CillyMe10-Nov-03 5:49 
AnswerRe: When exactly should a StringBuilder be used? Pin
LongRange.Shooter10-Nov-03 6:17
LongRange.Shooter10-Nov-03 6:17 
One of the standards that you need to apply to this decision of string vs. StringBuilder comes when you are looking at how frequently the code gets executed.

If a user clicks a button and that puts out the full name by doing firstName+" "+lastName then you can do the concats quite easily and not even think of a StringBuilder.

If you are constructing a large process that may be executed 10-1000 times per object processed AND you are doing concats in it, then you might get a performance benefit by using StringBuilders. However, you must keep in mind that you can still create process overhead even with a StringBuilder. For example:

C#
StringBuild workArea;
for (int i=0; i<1000; i++)
{
   ... process
   workArea.Append(someString);
   ...
   string answer = workArea.ToString();
}


Once you have set a string to a value of a StringBuilder.ToString() value, you should create a new StringBuilder and cannot use it multiple times.

Another item to consider is if you are doing a looped process and doing alot of checks if either stringA == stringB or stringA == "" then you get the best performance by doing stringA.Equals(stringB) AND stringA.Length == 0.



_____________________________________________
The world is a dangerous place.
Not because of those that do evil,
    but because of those who look on and do nothing.

Generaltemp monitor from motherboard Pin
Rob Tomson9-Nov-03 9:38
Rob Tomson9-Nov-03 9:38 
GeneralRe: temp monitor from motherboard Pin
Nick Parker9-Nov-03 10:21
protectorNick Parker9-Nov-03 10:21 
GeneralRe: temp monitor from motherboard Pin
Rob Tomson10-Nov-03 4:07
Rob Tomson10-Nov-03 4:07 
GeneralDataAccess Control Pin
Inam9-Nov-03 7:38
Inam9-Nov-03 7:38 
GeneralAdding value to registry... Pin
Amirjalaly9-Nov-03 6:38
Amirjalaly9-Nov-03 6:38 
GeneralRe: Adding value to registry... Pin
Corinna John9-Nov-03 8:05
Corinna John9-Nov-03 8:05 
GeneralRe: Adding value to registry... Pin
Anonymous10-Nov-03 2:50
Anonymous10-Nov-03 2:50 
GeneralRe: Adding value to registry... Pin
Corinna John10-Nov-03 3:01
Corinna John10-Nov-03 3:01 
GeneralRe: Adding value to registry... Pin
Braulio Dez9-Nov-03 21:44
Braulio Dez9-Nov-03 21:44 
GeneralRe: Adding value to registry... Pin
Alvaro Mendez10-Nov-03 8:43
Alvaro Mendez10-Nov-03 8:43 
QuestionWhat book do i need? Pin
eggie59-Nov-03 6:02
eggie59-Nov-03 6:02 
AnswerRe: What book do i need? Pin
eggie59-Nov-03 6:10
eggie59-Nov-03 6:10 
AnswerRe: What book do i need? Pin
Nick Parker9-Nov-03 6:19
protectorNick Parker9-Nov-03 6:19 
AnswerRe: What book do i need? Pin
Vasudevan Deepak Kumar9-Nov-03 20:44
Vasudevan Deepak Kumar9-Nov-03 20:44 
QuestionHow to tell if computer is signed on Pin
mcgahanfl9-Nov-03 2:36
mcgahanfl9-Nov-03 2:36 
AnswerRe: How to tell if computer is signed on Pin
Corinna John9-Nov-03 8:14
Corinna John9-Nov-03 8:14 
GeneralRe: How to tell if computer is signed on Pin
mcgahanfl10-Nov-03 2:42
mcgahanfl10-Nov-03 2:42 

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.