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!