neverwinter neverwinter - 8 months ago 66
C# Question

StreamWriter 64512 character limitation

I am using stringbuilder to collect some strings in my code. At the of that code my stringbuilder has more than 100000 chars.

But writeline function writes only first 64512 chars in stringBuilder. When I debugged the code I saw that stringbuilder is able to return all of 100000 chars, but streamwriter can't handle these all charachters. My stringbuilder variable is

in the code below.

System.IO.StreamWriter file = new System.IO.StreamWriter(txtDP.Text + "\\" + txtPmmlName.Text + ".txt");

How can I print all these chars to file via stringbuilder wihtout spliting the stringbuilder a few pieces?


I added the code below. It worked for me

file.AutoFlush = true;