You need to write a method that combines an unknown number of strings. The solution must
minimize the amount of memory used by the method when the method executes.
What should you include in the code?

A.
The String.Concat method
B.
The StringBuilder.Append method
C.
The + operator
D.
The += operator
Explanation:
A: String.Concat Method
Concatenates one or more instances of String, or the String representations of the values of one or
more instances of Object.
Correct is B since performance is at hand, every string.concat call creates a new string object which will occupy the memory.
https://msdn.microsoft.com/en-us/library/ms228504.aspx
4
0
agree, thanks
1
0
If you are not concatenating large numbers of strings (for example, in a loop), the performance cost of this code is probably not significant. The same is true for the String.Concat and String.Format methods.
However, when performance is important, you should always use the StringBuilder class to concatenate strings
0
0