Click here to Skip to main content
15,913,685 members
Home / Discussions / C#
   

C#

 
AnswerRe: class concept Pin
PIEBALDconsult29-Jun-10 3:47
mvePIEBALDconsult29-Jun-10 3:47 
GeneralRe: class concept Pin
Yonathan111130-Jun-10 20:43
professionalYonathan111130-Jun-10 20:43 
QuestionAutomated UI Tests of GDI Pin
Berlus29-Jun-10 1:39
Berlus29-Jun-10 1:39 
AnswerRe: Automated UI Tests of GDI Pin
Ennis Ray Lynch, Jr.29-Jun-10 3:40
Ennis Ray Lynch, Jr.29-Jun-10 3:40 
QuestionInsert variable into string Pin
lukeer29-Jun-10 1:37
lukeer29-Jun-10 1:37 
AnswerRe: Insert variable into string Pin
Łukasz Nowakowski29-Jun-10 1:56
Łukasz Nowakowski29-Jun-10 1:56 
GeneralRe: Insert variable into string Pin
Rhys Jacob29-Jun-10 2:52
Rhys Jacob29-Jun-10 2:52 
GeneralRe: Insert variable into string Pin
Keith Barrow29-Jun-10 4:13
professionalKeith Barrow29-Jun-10 4:13 
I totally agree the 1st form is better, just on readability alone.

I'd question your point about the StringBuilder as a replacement for the second form, creating an instance of this type has some overhead, for small concatenations the string builder is worse than the code supplied in the OP, but it has become received wisdom that StringBuilder is more efficient.

I posted a link a while back http://www.yoda.arachsys.com/csharp/stringbuilder.html[^] to an archive of stuff John Skeet has written about c# amongst others. He has tested the received wisdom, and found it wanting, the section "So I Should Use StringBuilder Everywhere, Right?" is really the nub of the problem.

It's worth doing the test he suggests, for "small" concats the overhead of the StringBuilder outweighs the benefits (and dirties the code). For multiple concats (e.g. in a loop)
StringBuilder<code> is much more efficient.<br />
<div class="signature"><small>Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.<br />
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.</small></div>

GeneralRe: Insert variable into string Pin
William Winner29-Jun-10 8:47
William Winner29-Jun-10 8:47 
GeneralRe: Insert variable into string Pin
Keith Barrow29-Jun-10 11:04
professionalKeith Barrow29-Jun-10 11:04 
GeneralRe: Insert variable into string Pin
William Winner29-Jun-10 11:17
William Winner29-Jun-10 11:17 
GeneralRe: Insert variable into string Pin
kevinnicol29-Jun-10 7:08
kevinnicol29-Jun-10 7:08 
GeneralRe: Insert variable into string Pin
PIEBALDconsult29-Jun-10 14:36
mvePIEBALDconsult29-Jun-10 14:36 
GeneralRe: Insert variable into string Pin
William Winner29-Jun-10 8:12
William Winner29-Jun-10 8:12 
GeneralRe: Insert variable into string Pin
Łukasz Nowakowski29-Jun-10 8:23
Łukasz Nowakowski29-Jun-10 8:23 
AnswerRe: Insert variable into string Pin
yu-jian30-Jun-10 19:19
yu-jian30-Jun-10 19:19 
QuestionSysListView32 another application Pin
iceeeeman28-Jun-10 21:36
iceeeeman28-Jun-10 21:36 
AnswerRe: SysListView32 another application Pin
Richard MacCutchan28-Jun-10 21:39
mveRichard MacCutchan28-Jun-10 21:39 
GeneralRe: SysListView32 another application Pin
iceeeeman28-Jun-10 21:50
iceeeeman28-Jun-10 21:50 
GeneralRe: SysListView32 another application Pin
Richard MacCutchan29-Jun-10 2:36
mveRichard MacCutchan29-Jun-10 2:36 
GeneralRe: SysListView32 another application Pin
iceeeeman29-Jun-10 6:05
iceeeeman29-Jun-10 6:05 
GeneralRe: SysListView32 another application Pin
Richard MacCutchan29-Jun-10 6:45
mveRichard MacCutchan29-Jun-10 6:45 
QuestionCustom Session Pin
satsumatable28-Jun-10 20:01
satsumatable28-Jun-10 20:01 
AnswerRe: Custom Session Pin
Ennis Ray Lynch, Jr.29-Jun-10 5:38
Ennis Ray Lynch, Jr.29-Jun-10 5:38 
QuestionQestion about FieldInfo[] reflection Pin
andreas0428-Jun-10 19:51
andreas0428-Jun-10 19:51 

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.