Reputation: 184
I have a big string (20K lines * 100 character each).
I need to place this string into a RichTextBox (or any similar thing) of a windows forms application, currently it takes 40 second to do so, (appending the String itself takes 40 sec).
Here is a code snippet
StringBuilder sb = Very_big_String_Builder_Object;
string appendMe = sb.ToString();
uniqueOutput.SelectionStart = uniqueOutput.TextLength;
uniqueOutput.SelectedText = appendMe;
I also tried
StringBuilder sb = Very_big_String_Builder_Object;
string appendMe = sb.ToString();
uniqueOutput.Text = appendMe;
which was a little bit worst.
Is there anything within .NET (up to 4.5) that can help ?
Upvotes: 1
Views: 552
Reputation: 2297
Try using a TextBox with multiline True:
txtMulti.text = Very_big_String_Builder_Object.ToString;
Upvotes: 1
Reputation: 598
Disabling WordWrap and DetectUrls will surely save you a couple of seconds.
Upvotes: 2