This content has been marked as final. Show 2 replies
No way to answer that question. You'll have to test the two approaches in your particular situation.
Although I wouldn't even worry about it until you have properly profiled your application and this is shown to be the cause of any performance problems you might have.
Until then, go for whatever code most clearly matches the intent and purpose of the solution.
I didn't get that. What's the perform section? What's affective? Do you mean efficient?
There's no clear answer except this one: the difference in efficiency is not great enough for you to worry about in the vast majority of cases. Use the one that's more convenient for the situation. Even if you run into performance problems, a shift to either MessageFormat or StringBuilder is unlikely to solve it.
I would consider MessageFormat more high-level, which would indicate that StringBuilder might be slightly faster in some situations, but it would depend, and there are probably exceptions where it's the other way around.
Edited by: OleVV on Sep 24, 2007 8:58 AM