Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9184823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:08:50+00:00 2026-06-17T19:08:50+00:00

Ive read a few posts on here and the common suggestion is that stringbuilder

  • 0

Ive read a few posts on here and the common suggestion is that stringbuilder is the most efficent if joining over three strings.

all variables are other properties.

public string Summary
{
  get 
  {
    return Name.Replace("_", " ") + "<strong>[" + Total + " Devices - " + BadCount + " Offline, " + PendingCount + " Pending]</strong>";
  }
}

Im joining four, is a simple concatenation suitable or should I ue stringbuilder? Just seems a little overkill.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:08:51+00:00Added an answer on June 17, 2026 at 7:08 pm

    Use whatever is most readable in this case. Otherwise it’s premature optimization.

    I would use String.Format:

    String result = String.Format("{0}<strong>[{1} Devices - {2} Offline, {3} Pending]</strong>"
    , Name.Replace("_", " ")
    , Total
    , BadCount
    , PendingCount);
    return result;
    

    Even string concatenation is not that bad since strings are stored in the intern pool. So if you use a string a second time it’s not created but the already available reference is used.

    So as rule of thumb:

    • If you’re concatenating few strings and the code gets hardly to understand, use String.Format
    • If you’re concatenating few (literal) strings and the code is still readable, use +(string concatenation)
    • If you’re creating strings in a (long) loop with variable strings, use a StringBuilder
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've read a few answers on here that condemn the use of svn:externals. I
Hey there, I have read the few posts here on when/how to use the
I've read a few posts on the topic, . Here is my strategy; I
Before we start, I've read more than a few other posts here related to
I've read a few posts here on StackOverflow about task scheduling, but I'm not
I've I've read a few similar posts on here without success. What I want
I've read a few articles on here and the web that have informed me
i've read a few other post on here regarding this topic. I understand that
I've read a few posts on this but I'm still confused. I have this
i've just read a few posts on hiding Silverlight code in some way. Main

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.