Click here to Skip to main content
15,917,455 members
Home / Discussions / C#
   

C#

 
QuestionHow to remove blank pages in a PDF from C# Application [modified] Pin
kalyan_vb29-Jun-10 5:31
kalyan_vb29-Jun-10 5:31 
Questionclass concept Pin
Yonathan111129-Jun-10 1:46
professionalYonathan111129-Jun-10 1:46 
AnswerRe: class concept Pin
J4amieC29-Jun-10 2:23
J4amieC29-Jun-10 2:23 
GeneralRe: class concept Pin
Yonathan111130-Jun-10 20:37
professionalYonathan111130-Jun-10 20:37 
AnswerRe: class concept Pin
Richard MacCutchan29-Jun-10 2:42
mveRichard MacCutchan29-Jun-10 2:42 
GeneralRe: class concept Pin
Yonathan111130-Jun-10 20:39
professionalYonathan111130-Jun-10 20:39 
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 
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 
I'm not convinced String.Format is more efficient than the straight concat, but I do think the format route is clearer.

Disassembling String.Format gives this line:
StringBuilder builder = new StringBuilder(format.Length + (args.Length * 8));

So it is likely that, as long as the argument passed average 8 characters or less, the StringBuilder will probably be more efficient at first glance. Of course, I haven't tested this, but it would be easy to rig a test to find out.

The point I was trying to make was that the assumption that StringBuilder is always more efficient than direct string manipulation is demonstrably false. Additionally, I'd say, unless the code is a block you know will be heavily repeated, early optimisation will ruin otherwise clear code without real benefit. I personally would only consider using a StringBuilder when I know this is the case, or testing reveals poor performance, or the system must perform with the highest possible efficiency for some reason(e.g. real time). This is in line with the KSS and YAGNI principles.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.

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 

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.