You are developing an application that will convertdata into multiple output formats.
The application includes the following code. (Line numbers are included for reference only.)
You are developing a code segment that will producetab-delimited output. All output routines implement the
following interface:
You need to minimize the completion time of the GetOutput() method. Which code segment should you
insert at line 06?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
实测值A比B好像更快一点点,集合越大这个差距越明显。
B, use stringbuilder
question mention fastness , string builder is fast as no new object needs to be created
B.
Using the StringBuilder class can boost performance when concatenating many strings together in a loop.
https://msdn.microsoft.com/en-us/library/2839d5h5(v=vs.110).aspx