Click here to Skip to main content
15,915,019 members
Home / Discussions / C#
   

C#

 
GeneralRe: string concatenation: several seconds Pin
pirotrav2-Dec-11 3:13
pirotrav2-Dec-11 3:13 
GeneralRe: string concatenation: several seconds Pin
Not Active2-Dec-11 4:04
mentorNot Active2-Dec-11 4:04 
AnswerRe: string concatenation: several seconds Pin
emardini2-Dec-11 3:34
emardini2-Dec-11 3:34 
GeneralRe: string concatenation: several seconds Pin
pirotrav2-Dec-11 21:03
pirotrav2-Dec-11 21:03 
GeneralRe: string concatenation: several seconds Pin
Gerry Schmitz2-Dec-11 22:23
mveGerry Schmitz2-Dec-11 22:23 
GeneralRe: string concatenation: several seconds Pin
pirotrav3-Dec-11 19:26
pirotrav3-Dec-11 19:26 
AnswerRe: string concatenation: several seconds Pin
PIEBALDconsult2-Dec-11 3:48
mvePIEBALDconsult2-Dec-11 3:48 
AnswerRe: string concatenation: several seconds Pin
OriginalGriff2-Dec-11 4:14
mveOriginalGriff2-Dec-11 4:14 
If "sorted" is as you say an array of strings, why faff with it at all?
C#
txtOutput.Lines = sorted;


I just tried your code and mine:
C#
string[] data = File.ReadAllLines(@"D:\Temp\MyLargeTextFile.txt");
Stopwatch s1 = new Stopwatch();
Stopwatch s2 = new Stopwatch();
s1.Start();
textBox1.Lines = data;
s1.Stop();
s2.Start();
StringBuilder sb = new StringBuilder();
foreach (string s in data)
    {
    sb.Append(s);
    sb.Append("\r\n");
    }
textBox2.Text = sb.ToString();
s2.Stop();
Console.WriteLine("{0} lines: {1}/{2}", data.Length,s1.Elapsed, s2.Elapsed);
The output I get is nothing like yours:
22777 lines: 00:00:01.5580246/00:00:01.5555734

How did you time your operations?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

QuestionRe: string concatenation: several seconds Pin
Luc Pattyn2-Dec-11 4:57
sitebuilderLuc Pattyn2-Dec-11 4:57 
AnswerRe: string concatenation: several seconds Pin
OriginalGriff2-Dec-11 5:56
mveOriginalGriff2-Dec-11 5:56 
AnswerRe: string concatenation: several seconds Pin
BobJanova2-Dec-11 6:15
BobJanova2-Dec-11 6:15 
AnswerRe: string concatenation: several seconds Pin
Rick Bassham2-Dec-11 6:16
Rick Bassham2-Dec-11 6:16 
AnswerRe: string concatenation: several seconds Pin
#realJSOP2-Dec-11 7:10
professional#realJSOP2-Dec-11 7:10 
GeneralRe: string concatenation: several seconds Pin
phil.o2-Dec-11 8:46
professionalphil.o2-Dec-11 8:46 
AnswerRe: string concatenation: several seconds Pin
Eddy Vluggen2-Dec-11 7:27
professionalEddy Vluggen2-Dec-11 7:27 
AnswerRe: string concatenation: several seconds Pin
BillWoodruff2-Dec-11 20:11
professionalBillWoodruff2-Dec-11 20:11 
QuestionChanging ForeColor Item in ListBox ... Pin
nassimnastaran2-Dec-11 0:41
nassimnastaran2-Dec-11 0:41 
AnswerRe: Changing ForeColor Item in ListBox ... Pin
Dan Mos2-Dec-11 1:03
Dan Mos2-Dec-11 1:03 
AnswerRe: Changing ForeColor Item in ListBox ... PinPopular
Alan N2-Dec-11 1:49
Alan N2-Dec-11 1:49 
GeneralRe: Changing ForeColor Item in ListBox ... Pin
Dan Mos2-Dec-11 1:55
Dan Mos2-Dec-11 1:55 
GeneralRe: Changing ForeColor Item in ListBox ... Pin
Wonde Tadesse2-Dec-11 17:05
professionalWonde Tadesse2-Dec-11 17:05 
AnswerRe: Changing ForeColor Item in ListBox ... Pin
Luc Pattyn2-Dec-11 4:06
sitebuilderLuc Pattyn2-Dec-11 4:06 
AnswerRe: Changing ForeColor Item in ListBox ... Pin
BobJanova2-Dec-11 5:46
BobJanova2-Dec-11 5:46 
QuestionWhat should be the Return Type? Pin
AmbiguousName1-Dec-11 23:40
AmbiguousName1-Dec-11 23:40 
AnswerRe: What should be the Return Type? Pin
BobJanova1-Dec-11 23:55
BobJanova1-Dec-11 23:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.