PART II
C h a p t e r 2 2 :
S t r i n g s a n d F o r m a t t i n g
671
exist. The reason is efficiency; passing up to four arguments is more efficient than using a
variable-length argument list.
The following program demonstrates the variable-length argument version of
Concat( )
:
// Demonstrate Concat().
using System;
class ConcatDemo {
static void Main() {
string result = String.Concat("This ", "is ", "a ",
"test ", "of ", "the ",
"String ", "class.");
Console.WriteLine("result: " + result);
}
}
The output is shown here:
result: This is a test of the String class.
There are also versions of the
Do'stlaringiz bilan baham: |