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

  • Home
  • SEARCH
  • 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 6230575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:46:29+00:00 2026-05-24T09:46:29+00:00

I am trying to dynamically create a StringBuilder array in C# and I haven’t

  • 0

I am trying to dynamically create a StringBuilder array in C# and I haven’t had much luck.

I want to add information to a StringBuilder (sb) based off of a given client digit that will change dynamically depending on how many clients I might have. I might have 2 or I might have 20. The sb will be used to build a report based per client later in my program.

For example I have the following 3 clients:

    Client A = 0 
    Client B = 1
    Client C = 2

If Client A is reporting he has 8 apples I want to add the string “8 apples” to sb[0].

If Client B is reporting he has 3 oranges I want to add the string “3 oranges” to sb[1].

The above is just a simple example of the idea I am trying to accomplish. In reality I am going to be adding a lot of information to the sb.

I have tried the following without much luck getting them to work they way I expected or wanted.

StringBuilder[] sbFileError = new StringBuilder[clientCount];
List<StringBuilder> sbFileError = new List<StringBuilder>();

Any thoughts? Is it possible to create a StringBuilder array?

Thanks!

  • 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-05-24T09:46:30+00:00Added an answer on May 24, 2026 at 9:46 am

    You’ve created the containers above, but you need to fill them with something. For example:

    StringBuilder[] sbFileError = new StringBuilder[clientCount];
    for (int ix = 0;  ix < clientCount;  ++ix)
        sbFileError[ix] = new StringBuilder();
    

    Or

    List<StringBuilder> sbFileError = new List<StringBuilder>();
    for (int ix = 0;  ix < clientCount;  ++ix)
        sbFileError.Add(new StringBuilder());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to dynamically create a Bitmap Image using byte array using following
I'm trying to create a function that would dynamically allocate an array, sets the
I'm currently trying dynamically create an html table in PHP. Further, I want the
im trying to dynamically create elements in the child window based on the values
I'm trying to dynamically create objects out of forms, but I want some reduntant
I'm trying to create dynamically generated code based on user input (just like a
I am trying to dynamically create pagination links based on the total number of
I am trying to dynamically create grid.Panels and add them to my View, since
I'm trying to dynamically create a set of labels in my XUL Runner application.
I'm trying to dynamically create a connection string during compile time: private static string

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.