String.Concat String.Concat String.Concat String.Concat Method

Definition

String의 인스턴스를 하나 이상 연결하거나 String의 인스턴스 값에 해당하는 Object 표현을 하나 이상 연결합니다. Concatenates one or more instances of String, or the String representations of the values of one or more instances of Object.

Overloads

Concat(String, String, String, String) Concat(String, String, String, String) Concat(String, String, String, String) Concat(String, String, String, String)

String의 지정된 네 인스턴스를 연결합니다. Concatenates four specified instances of String.

Concat(Object, Object, Object, Object) Concat(Object, Object, Object, Object) Concat(Object, Object, Object, Object) Concat(Object, Object, Object, Object)

지정된 네 개체의 문자열 표현과 선택적 변수 길이 매개 변수 목록에 지정된 개체를 연결합니다. Concatenates the string representations of four specified objects and any objects specified in an optional variable length parameter list.

Concat(Object, Object, Object) Concat(Object, Object, Object) Concat(Object, Object, Object) Concat(Object, Object, Object)

지정된 세 개체의 문자열 표현을 연결합니다. Concatenates the string representations of three specified objects.

Concat(String, String) Concat(String, String) Concat(String, String) Concat(String, String)

String의 지정된 두 인스턴스를 연결합니다. Concatenates two specified instances of String.

Concat(String, String, String) Concat(String, String, String) Concat(String, String, String) Concat(String, String, String)

String의 지정된 세 인스턴스를 연결합니다. Concatenates three specified instances of String.

Concat(String[]) Concat(String[]) Concat(String[]) Concat(String[])

지정된 String 배열의 요소를 연결합니다. Concatenates the elements of a specified String array.

Concat(Object[]) Concat(Object[]) Concat(Object[]) Concat(Object[])

지정된 Object 배열에 있는 요소의 문자열 표현을 연결합니다. Concatenates the string representations of the elements in a specified Object array.

Concat(Object) Concat(Object) Concat(Object) Concat(Object)

지정된 개체의 문자열 표현을 만듭니다. Creates the string representation of a specified object.

Concat(IEnumerable<String>) Concat(IEnumerable<String>) Concat(IEnumerable<String>) Concat(IEnumerable<String>)

IEnumerable<T> 형식의 생성된 String 컬렉션의 멤버를 연결합니다. Concatenates the members of a constructed IEnumerable<T> collection of type String.

Concat(Object, Object) Concat(Object, Object) Concat(Object, Object) Concat(Object, Object)

지정된 두 개체의 문자열 표현을 연결합니다. Concatenates the string representations of two specified objects.

Concat<T>(IEnumerable<T>) Concat<T>(IEnumerable<T>) Concat<T>(IEnumerable<T>) Concat<T>(IEnumerable<T>)

IEnumerable<T> 구현의 멤버를 연결합니다. Concatenates the members of an IEnumerable<T> implementation.

Concat(String, String, String, String) Concat(String, String, String, String) Concat(String, String, String, String) Concat(String, String, String, String)

String의 지정된 네 인스턴스를 연결합니다. Concatenates four specified instances of String.

public:
 static System::String ^ Concat(System::String ^ str0, System::String ^ str1, System::String ^ str2, System::String ^ str3);
public static string Concat (string str0, string str1, string str2, string str3);
static member Concat : string * string * string * string -> string
Public Shared Function Concat (str0 As String, str1 As String, str2 As String, str3 As String) As String

매개 변수

str0
String String String String

연결할 첫 번째 문자열입니다. The first string to concatenate.

str1
String String String String

연결할 두 번째 문자열입니다. The second string to concatenate.

str2
String String String String

연결할 세 번째 문자열입니다. The third string to concatenate.

str3
String String String String

연결할 네 번째 문자열입니다. The fourth string to concatenate.

Returns

연결된 str0, str1, str2str3를 반환합니다. The concatenation of str0, str1, str2, and str3.

Examples

다음 예에서는 4 자 단어의 배열을 정의 하 고 스크램블 하기 위해 문자열 배열에 개별 문자를 저장 합니다.The following example defines an array of four-letter words and stores their individual letters to a string array in order to scramble them. 그런 다음 호출 하 여 Concat(String, String, String, String) 암호화 된 단어를 어셈블해야 하기 때문에 메서드.It then calls the Concat(String, String, String, String) method to reassemble the scrambled words.

using System;
using System.Collections;

public class Example
{
   public static void Main()
   {
      const int WORD_SIZE = 4;
      
      // Define some 4-letter words to be scrambled.
      string[] words = { "home", "food", "game", "rest" };
      // Define two arrays equal to the number of letters in each word.
      double[] keys = new double[WORD_SIZE];
      string[] letters = new string[WORD_SIZE];
      // Initialize the random number generator.
      Random rnd = new Random();
      
      // Scramble each word.
      foreach (string word in words)
      {
         for (int ctr = 0; ctr < word.Length; ctr++)
         {
            // Populate the array of keys with random numbers.
            keys[ctr] = rnd.NextDouble();
            // Assign a letter to the array of letters.
            letters[ctr] = word[ctr].ToString();
         }   
         // Sort the array. 
         Array.Sort(keys, letters, 0, WORD_SIZE, Comparer.Default);      
         // Display the scrambled word.
         string scrambledWord = String.Concat(letters[0], letters[1], 
                                              letters[2], letters[3]);
         Console.WriteLine("{0} --> {1}", word, scrambledWord);
      } 
   }
}
// The example displays output like the following:
//       home --> mheo
//       food --> oodf
//       game --> aemg
//       rest --> trse
Imports System.Collections

Module Example
   Public Sub Main()
      Const WORD_SIZE As Integer = 4
      
      ' Define some 4-letter words to be scrambled.
      Dim words() As String = { "home", "food", "game", "rest" }
      ' Define two arrays equal to the number of letters in each word.
      Dim keys(WORD_SIZE) As Double
      Dim letters(WORD_SIZE) As String
      ' Initialize the random number generator.
      Dim rnd As New Random()
      
      ' Scramble each word.
      For Each word As String In words
         For ctr As Integer = 0 To word.Length - 1
            ' Populate the array of keys with random numbers.
            keys(ctr) = rnd.NextDouble()
            ' Assign a letter to the array of letters.
            letters(ctr) = word.Chars(ctr)
         Next   
         ' Sort the array. 
         Array.Sort(keys, letters, 0, WORD_SIZE, Comparer.Default)      
         ' Display the scrambled word.
         Dim scrambledWord As String = String.Concat(letters(0), letters(1), _
                                                     letters(2), letters(3))
         Console.WriteLine("{0} --> {1}", word, scrambledWord)
      Next 
   End Sub
End Module 
' The example displays output like the following:
'       home --> mheo
'       food --> oodf
'       game --> aemg
'       rest --> trse

Remarks

메서드를 연결 str0, str1str2, 및 str3; 구분 기호를 추가 하지 않습니다.The method concatenates str0, str1, str2, and str3; it does not add any delimiters.

참고

사용할 수도 있습니다 언어의 문자열 연결 연산자와 같은 + C#에서 또는 &+ Visual basic에서)You can also use your language's string concatenation operator, such as + in C#, or & and + in Visual Basic)

에서 문자열을 연결 합니다., to concatenate strings.

Empty 문자열 배열에 있는 빈 개체 대신 사용 됩니다.An Empty string is used in place of any null object in the array.

See Also

Concat(Object, Object, Object, Object) Concat(Object, Object, Object, Object) Concat(Object, Object, Object, Object) Concat(Object, Object, Object, Object)

중요

This API is not CLS-compliant.

지정된 네 개체의 문자열 표현과 선택적 변수 길이 매개 변수 목록에 지정된 개체를 연결합니다. Concatenates the string representations of four specified objects and any objects specified in an optional variable length parameter list.

public:
 static System::String ^ Concat(System::Object ^ arg0, System::Object ^ arg1, System::Object ^ arg2, System::Object ^ arg3);
[System.CLSCompliant(false)]
public static string Concat (object arg0, object arg1, object arg2, object arg3);
static member Concat : obj * obj * obj * obj -> string
Public Shared Function Concat (arg0 As Object, arg1 As Object, arg2 As Object, arg3 As Object) As String

매개 변수

arg0
Object Object Object Object

연결할 첫 번째 개체입니다. The first object to concatenate.

arg1
Object Object Object Object

연결할 두 번째 개체입니다. The second object to concatenate.

arg2
Object Object Object Object

연결할 세 번째 개체입니다. The third object to concatenate.

arg3
Object Object Object Object

연결할 네 번째 개체입니다. The fourth object to concatenate.

Returns

매개 변수 목록에서 각 값의 연결된 문자열 표현입니다. The concatenated string representation of each value in the parameter list.

Examples

다음 예제를 사용 하 여 Concat(Object, Object, Object, Object) 가변 매개 변수 목록을 연결 하는 방법.The following example illustrates the use of the Concat(Object, Object, Object, Object) method to concatenate a list of variable parameters. 이 경우에 메서드는 9 개의 매개 변수를 사용 하 여 호출 됩니다.In this case, the method is called with nine parameters.

using System;
using System.Collections;

public class Example
{
   public static void Main()
   {
      const int WORD_SIZE = 4;
      
      // Define some 4-letter words to be scrambled.
      string[] words = { "home", "food", "game", "rest" };
      // Define two arrays equal to the number of letters in each word.
      double[] keys = new double[WORD_SIZE];
      string[] letters = new string[WORD_SIZE];
      // Initialize the random number generator.
      Random rnd = new Random();
      
      // Scramble each word.
      foreach (string word in words)
      {
         for (int ctr = 0; ctr < word.Length; ctr++)
         {
            // Populate the array of keys with random numbers.
            keys[ctr] = rnd.NextDouble();
            // Assign a letter to the array of letters.
            letters[ctr] = word[ctr].ToString();
         }   
         // Sort the array. 
         Array.Sort(keys, letters, 0, WORD_SIZE, Comparer.Default);      
         // Display the scrambled word.
         string scrambledWord = String.Concat(letters[0], letters[1], 
                                              letters[2], letters[3]);
         Console.WriteLine("{0} --> {1}", word, scrambledWord);
      } 
   }
}
// The example displays output like the following:
//       home --> mheo
//       food --> oodf
//       game --> aemg
//       rest --> trse
Imports System.Collections

Module Example
   Public Sub Main()
      Const WORD_SIZE As Integer = 4
      
      ' Define some 4-letter words to be scrambled.
      Dim words() As String = { "home", "food", "game", "rest" }
      ' Define two arrays equal to the number of letters in each word.
      Dim keys(WORD_SIZE) As Double
      Dim letters(WORD_SIZE) As String
      ' Initialize the random number generator.
      Dim rnd As New Random()
      
      ' Scramble each word.
      For Each word As String In words
         For ctr As Integer = 0 To word.Length - 1
            ' Populate the array of keys with random numbers.
            keys(ctr) = rnd.NextDouble()
            ' Assign a letter to the array of letters.
            letters(ctr) = word.Chars(ctr)
         Next   
         ' Sort the array. 
         Array.Sort(keys, letters, 0, WORD_SIZE, Comparer.Default)      
         ' Display the scrambled word.
         Dim scrambledWord As String = String.Concat(letters(0), letters(1), _
                                                     letters(2), letters(3))
         Console.WriteLine("{0} --> {1}", word, scrambledWord)
      Next 
   End Sub
End Module 
' The example displays output like the following:
'       home --> mheo
'       food --> oodf
'       game --> aemg
'       rest --> trse

Remarks

참고

이 API는 CLS 규격이 아닙니다.This API is not CLS-compliant. CLS 규격 대체 항목은 String.Concat(Object[])입니다.The CLS-compliant alternative is String.Concat(Object[]). C# 및 Visual Basic 컴파일러에 대 한 호출으로이 메서드에 대 한 호출을 자동으로 해결 String.Concat(Object[])합니다.The C# and Visual Basic compilers automatically resolve a call to this method as a call to String.Concat(Object[]).

메서드는 매개 변수가 없는 호출 하 여 매개 변수 목록의 각 개체를 연결 ToString 메서드; 구분 기호를 추가 하지 않습니다.The method concatenates each object in the parameter list by calling its parameterless ToString method; it does not add any delimiters.

String.Empty null 인수 대신 사용 됩니다.String.Empty is used in place of any null argument.

참고

마지막 매개 변수는 Concat 메서드는 연결할 하나 이상의 추가 개체의 선택적 쉼표로 구분 된 목록입니다.The last parameter of the Concat method is an optional comma-delimited list of one or more additional objects to concatenate.

Notes to Callers

이 메서드가로 표시는 vararg 가변 개수의 매개 변수를 지원함을 의미 하는 키워드입니다. This method is marked with the vararg keyword, which means that it supports a variable number of parameters. Visual c + +에서 메서드를 호출할 수 있지만 C# 또는 Visual Basic 코드에서 호출할 수 없습니다. The method can be called from Visual C++, but it cannot be called from C# or Visual Basic code. C# 및 Visual Basic 컴파일러에 대 한 호출을 해결할 Concat(Object, Object, Object, Object) 호출로 Concat(Object[])합니다. The C# and Visual Basic compilers resolve calls to Concat(Object, Object, Object, Object) as calls to Concat(Object[]).

Concat(Object, Object, Object) Concat(Object, Object, Object) Concat(Object, Object, Object) Concat(Object, Object, Object)

지정된 세 개체의 문자열 표현을 연결합니다. Concatenates the string representations of three specified objects.

public:
 static System::String ^ Concat(System::Object ^ arg0, System::Object ^ arg1, System::Object ^ arg2);
public static string Concat (object arg0, object arg1, object arg2);
static member Concat : obj * obj * obj -> string
Public Shared Function Concat (arg0 As Object, arg1 As Object, arg2 As Object) As String

매개 변수

arg0
Object Object Object Object

연결할 첫 번째 개체입니다. The first object to concatenate.

arg1
Object Object Object Object

연결할 두 번째 개체입니다. The second object to concatenate.

arg2
Object Object Object Object

연결할 세 번째 개체입니다. The third object to concatenate.

Returns

arg0, arg1arg2 값의 연결된 문자열 표현입니다. The concatenated string representations of the values of arg0, arg1, and arg2.

Examples

다음 예제는 Concat 메서드.The following example demonstrates the Concat method.

using namespace System;

int main()
{
   int i = -123;
   Object^ o = i;
   array<Object^>^objs = { -123, -456, -789};
   Console::WriteLine("Concatenate 1, 2, and 3 objects:");
   Console::WriteLine("1) {0}", String::Concat(o));
   Console::WriteLine("2) {0}", String::Concat(o, o));
   Console::WriteLine("3) {0}", String::Concat(o, o, o));
   
   Console::WriteLine("\nConcatenate 4 objects and a variable length parameter list:" );
   Console::WriteLine("4) {0}", String::Concat(o, o, o, o));
   Console::WriteLine("5) {0}", String::Concat( o, o, o, o, o));
   Console::WriteLine("\nConcatenate a 3-element object array:");
   Console::WriteLine("6) {0}", String::Concat(objs));
}
// The example displays the following output:
//    Concatenate 1, 2, and 3 objects:
//    1) -123
//    2) -123-123
//    3) -123-123-123
//    
//    Concatenate 4 objects and a variable length parameter list:
//    4) -123-123-123-123
//    5) -123-123-123-123-123
//    
//    Concatenate a 3-element object array:
//    6) -123-456-789
using System;

class stringConcat5 {
    public static void Main() {
    int i = -123;
    Object o = i;
    Object[] objs = new Object[] {-123, -456, -789};

    Console.WriteLine("Concatenate 1, 2, and 3 objects:");
    Console.WriteLine("1) {0}", String.Concat(o));
    Console.WriteLine("2) {0}", String.Concat(o, o));
    Console.WriteLine("3) {0}", String.Concat(o, o, o));

    Console.WriteLine("\nConcatenate 4 objects and a variable length parameter list:");
    Console.WriteLine("4) {0}", String.Concat(o, o, o, o));
    Console.WriteLine("5) {0}", String.Concat(o, o, o, o, o));

    Console.WriteLine("\nConcatenate a 3-element object array:");
    Console.WriteLine("6) {0}", String.Concat(objs));
    }
}
// The example displays the following output:
//    Concatenate 1, 2, and 3 objects:
//    1) -123
//    2) -123-123
//    3) -123-123-123
//    
//    Concatenate 4 objects and a variable length parameter list:
//    4) -123-123-123-123
//    5) -123-123-123-123-123
//    
//    Concatenate a 3-element object array:
//    6) -123-456-789
Class stringConcat5
   Public Shared Sub Main()
      Dim i As Integer = - 123
      Dim o As [Object] = i
      Dim objs() As [Object] = {-123, -456, -789}
      
      Console.WriteLine("Concatenate 1, 2, and 3 objects:")
      Console.WriteLine("1) {0}", [String].Concat(o))
      Console.WriteLine("2) {0}", [String].Concat(o, o))
      Console.WriteLine("3) {0}", [String].Concat(o, o, o))
      
      Console.WriteLine(vbCrLf & "Concatenate 4 objects and a variable length parameter list:")
      Console.WriteLine("4) {0}", String.Concat(o, o, o, o))
      Console.WriteLine("5) {0}", String.Concat(o, o, o, o, o))
      
      Console.WriteLine(vbCrLf & "Concatenate a 3-element object array:")
      Console.WriteLine("6) {0}", [String].Concat(objs))
   End Sub
End Class
'The example displays the following output:
'    Concatenate 1, 2, and 3 objects:
'    1) -123
'    2) -123-123
'    3) -123-123-123
'    
'    Concatenate 4 objects and a variable length parameter list:
'    4) -123-123-123-123
'    5) -123-123-123-123-123
'         
'    Concatenate a 3-element object array:
'    6) -123-456-789

Remarks

메서드를 연결 arg0, arg1, 및 arg2 매개 변수가 없는 호출 하 여 ToString 개체당; 메서드의 모든 구분 기호를 추가 하지 않습니다.The method concatenates arg0, arg1, and arg2 by calling the parameterless ToString method of each object; it does not add any delimiters.

String.Empty null 인수 대신 사용 됩니다.String.Empty is used in place of any null argument.

See Also

Concat(String, String) Concat(String, String) Concat(String, String) Concat(String, String)

String의 지정된 두 인스턴스를 연결합니다. Concatenates two specified instances of String.

public:
 static System::String ^ Concat(System::String ^ str0, System::String ^ str1);
public static string Concat (string str0, string str1);
static member Concat : string * string -> string
Public Shared Function Concat (str0 As String, str1 As String) As String

매개 변수

str0
String String String String

연결할 첫 번째 문자열입니다. The first string to concatenate.

str1
String String String String

연결할 두 번째 문자열입니다. The second string to concatenate.

Returns

연결된 str0str1을 반환합니다. The concatenation of str0 and str1.

Examples

다음 예제에서는 사용자의 첫 번째, 중간 및 마지막 이름을 연결합니다.The following example concatenates a person's first, middle, and last name.

using namespace System;
int main()
{
   
   // we want to simply quickly add this person's name together
   String^ fName = "Simon";
   String^ mName = "Jake";
   String^ lName = "Harrows";
   
   // because we want a name to appear with a space in between each name, 
   // put a space on the front of the middle, and last name, allowing for
   // the fact that a space may already be there
   mName = String::Concat(  " ", mName->Trim() );
   lName = String::Concat(  " ", lName->Trim() );
   
   // this line simply concatenates the two strings
   Console::WriteLine( "Welcome to this page, '{0}'!", String::Concat( String::Concat( fName, mName ), lName ) );
}
// The example displays the following output:
//        Welcome to this page, 'Simon Jake Harrows'!
using System;

public class ConcatTest {
    public static void Main() {

        // we want to simply quickly add this person's name together
        string fName = "Simon";
        string mName = "Jake";
        string lName = "Harrows";

        // because we want a name to appear with a space in between each name, 
        // put a space on the front of the middle, and last name, allowing for
        // the fact that a space may already be there
        mName = " " + mName.Trim();
        lName = " " + lName.Trim();

        // this line simply concatenates the two strings
        Console.WriteLine("Welcome to this page, '{0}'!", string.Concat( string.Concat(fName, mName), lName ) );
    }
}
// The example displays the following output:
//        Welcome to this page, 'Simon Jake Harrows'!
Public Class ConcatTest
    Public Shared Sub Main()
        Dim fName As String = "Simon"
        Dim mName As String = "Jake"
        Dim lName As String = "Harrows"
        
        ' We want to simply quickly add this person's name together.
        ' Because we want a name to appear with a space in between each name, 
        ' we put a space on the front of the middle, and last name, allowing for
        ' the fact that a space may already be there.
        mName = " " + mName.Trim()
        lName = " " + lName.Trim()
        
        ' This line simply concatenates the two strings.
        Console.WriteLine("Welcome to this page, '{0}'!", _
                          String.Concat(String.Concat(fName, mName), lName))
    End Sub
End Class
' The example displays the following output:
'       Welcome to this page, 'Simon Jake Harrows'!

Remarks

메서드를 연결 str0str1; 구분 기호를 추가 하지 않습니다.The method concatenates str0 and str1; it does not add any delimiters.

참고

사용할 수도 있습니다 언어의 문자열 연결 연산자와 같은 + C#에서 또는 &+ Visual basic에서)You can also use your language's string concatenation operator, such as + in C#, or & and + in Visual Basic)

에서 문자열을 연결 합니다., to concatenate strings.

Empty 문자열이 null 인수 대신 사용 됩니다.An Empty string is used in place of any null argument.

See Also

Concat(String, String, String) Concat(String, String, String) Concat(String, String, String) Concat(String, String, String)

String의 지정된 세 인스턴스를 연결합니다. Concatenates three specified instances of String.

public:
 static System::String ^ Concat(System::String ^ str0, System::String ^ str1, System::String ^ str2);
public static string Concat (string str0, string str1, string str2);
static member Concat : string * string * string -> string
Public Shared Function Concat (str0 As String, str1 As String, str2 As String) As String

매개 변수

str0
String String String String

연결할 첫 번째 문자열입니다. The first string to concatenate.

str1
String String String String

연결할 두 번째 문자열입니다. The second string to concatenate.

str2
String String String String

연결할 세 번째 문자열입니다. The third string to concatenate.

Returns

연결된 str0, str1str2를 반환합니다. The concatenation of str0, str1, and str2.

Examples

다음 예제에서는 Concat 메서드 3 개를 연결 문자열 및 결과 표시 합니다.The following example uses the Concat method to concatenate three strings and displays the result.

using namespace System;

void main()
{
   String^ s1 = "We went to a bookstore, ";
   String^ s2 = "a movie, ";
   String^ s3 = "and a restaurant.";

   String^ s = String::Concat(s1, s2, s3);
   Console::WriteLine(s);
}
// The example displays the following output:
//      We went to a bookstore, a movie, and a restaurant. 
using System;

public class Example
{
   public static void Main()
   {
      String s1 = "We went to a bookstore, ";
      String s2 = "a movie, ";
      String s3 = "and a restaurant.";

      var s = String.Concat(s1, s2, s3);
      Console.WriteLine(s);
   }
}
// The example displays the following output:
//      We went to a bookstore, a movie, and a restaurant. 
Imports System

Public Module Example
   Public Sub Main()
      Dim s1 As String = "We went to a bookstore, "
      Dim s2 As String = "a movie, "
      Dim s3 As String = "and a restaurant."

      Dim s = String.Concat(s1, s2, s3)
      Console.WriteLine(s)
   End Sub
End Module
' The example displays the following output:
'      We went to a bookstore, a movie, and a restaurant. 

Remarks

메서드를 연결 str0, str1, 및 str2; 구분 기호를 추가 하지 않습니다.The method concatenates str0, str1, and str2; it does not add any delimiters.

참고

사용할 수도 있습니다 언어의 문자열 연결 연산자와 같은 + C#에서 또는 &+ Visual basic에서)You can also use your language's string concatenation operator, such as + in C#, or & and + in Visual Basic)

에서 문자열을 연결 합니다., to concatenate strings.

Empty 문자열이 null 인수 대신 사용 됩니다.An Empty string is used in place of any null argument.

See Also

Concat(String[]) Concat(String[]) Concat(String[]) Concat(String[])

중요

This API is not CLS-compliant.

지정된 String 배열의 요소를 연결합니다. Concatenates the elements of a specified String array.

public:
 static System::String ^ Concat(... cli::array <System::String ^> ^ values);
[System.CLSCompliant(false)]
public static string Concat (params string[] values);
static member Concat : string[] -> string
Public Shared Function Concat (ParamArray values As String()) As String

매개 변수

values
String[]

문자열 인스턴스의 배열입니다. An array of string instances.

Returns

values의 연결된 요소를 반환합니다. The concatenated elements of values.

Exceptions

Examples

다음 예제에서는 사용 합니다 Concat 메서드는 String 배열입니다.The following example demonstrates the use of the Concat method with a String array.

using namespace System;

int main()
{
   
   // Make an array of strings. Note that we have included spaces.
   array<String^>^s = { "hello ", "and ", "welcome ", "to ",
                        "this ", "demo! "};
   
   // Put all the strings together.
   Console::WriteLine( String::Concat(s) );
   
   // Sort the strings, and put them together.
   Array::Sort( s );
   Console::WriteLine( String::Concat(s));
}
// The example displays the following output:
//       hello and welcome to this demo!
//       and demo! hello this to welcome
using System;

public class Example
{
    public static void Main()
    {
        // Make an array of strings. Note that we have included spaces.
        string [] s = { "hello ", "and ", "welcome ", "to ",
                        "this ", "demo! " };

        // Put all the strings together.
        Console.WriteLine(string.Concat(s));

        // Sort the strings, and put them together.
        Array.Sort(s);
        Console.WriteLine(string.Concat(s));
    }
}
// The example displays the following output:
//       hello and welcome to this demo!
//       and demo! hello this to welcome
Public Class Example
    Public Shared Sub Main()
        ' Make an array of strings. Note that we have included spaces.
        Dim s As String() = { "hello ", "and ", "welcome ", "to ",
                              "this ", "demo! "}

        ' Put all the strings together.
        Console.WriteLine(String.Concat(s))
        
        ' Sort the strings, and put them together.
        Array.Sort(s)
        Console.WriteLine(String.Concat(s))
    End Sub
End Class
' The example displays the following output:
'       hello and welcome to this demo!
'       and demo! hello this to welcome

Remarks

각 개체에 연결 하는 메서드 values; 구분 기호를 추가 하지 않습니다.The method concatenates each object in values; it does not add any delimiters.

Empty 문자열 배열에 있는 빈 개체 대신 사용 됩니다.An Empty string is used in place of any null object in the array.

See Also

Concat(Object[]) Concat(Object[]) Concat(Object[]) Concat(Object[])

지정된 Object 배열에 있는 요소의 문자열 표현을 연결합니다. Concatenates the string representations of the elements in a specified Object array.

public:
 static System::String ^ Concat(... cli::array <System::Object ^> ^ args);
public static string Concat (params object[] args);
static member Concat : obj[] -> string
Public Shared Function Concat (ParamArray args As Object()) As String

매개 변수

args
Object[]

연결할 요소가 포함된 개체 배열입니다. An object array that contains the elements to concatenate.

Returns

args에 있는 요소 값의 연결된 문자열 표현입니다. The concatenated string representations of the values of the elements in args.

Exceptions

Examples

다음 예제에서는 사용 합니다 Concat 메서드는 Object 배열입니다.The following example demonstrates the use of the Concat method with an Object array.

using System;

public class ConcatTest {
    public static void Main() {
        // Create a group of objects.
        Test1 t1 = new Test1();
        Test2 t2 = new Test2();
        int i = 16;
        string s = "Demonstration";

        // Place the objects in an array.
        object [] o = { t1, i, t2, s };

        // Concatenate the objects together as a string. To do this,
        // the ToString method of each of the objects is called.
        Console.WriteLine(string.Concat(o));
    }
}

// Create two empty test classes.
class Test1 {
}

class Test2 {
}
// The example displays the following output:
//       Test116Test2Demonstration
Imports System



Public Class ConcatTest
    
    Public Shared Sub Main()
        Dim t1 As New Test1()
        Dim t2 As New Test2()
        Dim i As Integer = 16
        Dim s As String = "Demonstration"
        Dim o As Object() = {t1, i, t2, s}
        
        ' create a group of objects
        
        ' place the objects in an array
        
        ' concatenate the objects together as a string. To do this,
        ' the ToString method in the objects is called
        Console.WriteLine(String.Concat(o))
    End Sub 'Main
End Class 'ConcatTest


' imagine these test classes are full-fledged objects...
Class Test1
End Class 'Test1

Class Test2
End Class 'Test2

Remarks

각 개체에 연결 하는 메서드 args 매개 변수가 없는 호출 하 여 ToString 메서드는 개체의 모든 구분 기호를 추가 하지 않습니다.The method concatenates each object in args by calling the parameterless ToString method of that object; it does not add any delimiters.

String.Empty 배열에 있는 빈 개체 대신 사용 됩니다.String.Empty is used in place of any null object in the array.

Notes to Callers

이 메서드는 c + + 코드에서 호출 되지 않습니다. This method is not called by C++ code. C + + 컴파일러에 대 한 호출을 확인 Concat 호출으로 4 개 이상의 개체 매개 변수 있는 Concat(Object, Object, Object, Object)합니다. The C++ compiler resolves calls to Concat that have four or more object parameters as a call to Concat(Object, Object, Object, Object).

See Also

Concat(Object) Concat(Object) Concat(Object) Concat(Object)

지정된 개체의 문자열 표현을 만듭니다. Creates the string representation of a specified object.

public:
 static System::String ^ Concat(System::Object ^ arg0);
public static string Concat (object arg0);
static member Concat : obj -> string
Public Shared Function Concat (arg0 As Object) As String

매개 변수

arg0
Object Object Object Object

나타낼 개체나 null입니다. The object to represent, or null.

Returns

arg0Empty인 경우 arg0 또는 null 값의 문자열 표현입니다. The string representation of the value of arg0, or Empty if arg0 is null.

Examples

다음 예제는 Concat 메서드.The following example demonstrates the Concat method.

using namespace System;

int main()
{
   int i = -123;
   Object^ o = i;
   array<Object^>^objs = { -123, -456, -789};
   Console::WriteLine("Concatenate 1, 2, and 3 objects:");
   Console::WriteLine("1) {0}", String::Concat(o));
   Console::WriteLine("2) {0}", String::Concat(o, o));
   Console::WriteLine("3) {0}", String::Concat(o, o, o));
   
   Console::WriteLine("\nConcatenate 4 objects and a variable length parameter list:" );
   Console::WriteLine("4) {0}", String::Concat(o, o, o, o));
   Console::WriteLine("5) {0}", String::Concat( o, o, o, o, o));
   Console::WriteLine("\nConcatenate a 3-element object array:");
   Console::WriteLine("6) {0}", String::Concat(objs));
}
// The example displays the following output:
//    Concatenate 1, 2, and 3 objects:
//    1) -123
//    2) -123-123
//    3) -123-123-123
//    
//    Concatenate 4 objects and a variable length parameter list:
//    4) -123-123-123-123
//    5) -123-123-123-123-123
//    
//    Concatenate a 3-element object array:
//    6) -123-456-789
using System;

class stringConcat5 {
    public static void Main() {
    int i = -123;
    Object o = i;
    Object[] objs = new Object[] {-123, -456, -789};

    Console.WriteLine("Concatenate 1, 2, and 3 objects:");
    Console.WriteLine("1) {0}", String.Concat(o));
    Console.WriteLine("2) {0}", String.Concat(o, o));
    Console.WriteLine("3) {0}", String.Concat(o, o, o));

    Console.WriteLine("\nConcatenate 4 objects and a variable length parameter list:");
    Console.WriteLine("4) {0}", String.Concat(o, o, o, o));
    Console.WriteLine("5) {0}", String.Concat(o, o, o, o, o));

    Console.WriteLine("\nConcatenate a 3-element object array:");
    Console.WriteLine("6) {0}", String.Concat(objs));
    }
}
// The example displays the following output:
//    Concatenate 1, 2, and 3 objects:
//    1) -123
//    2) -123-123
//    3) -123-123-123
//    
//    Concatenate 4 objects and a variable length parameter list:
//    4) -123-123-123-123
//    5) -123-123-123-123-123
//    
//    Concatenate a 3-element object array:
//    6) -123-456-789
Class stringConcat5
   Public Shared Sub Main()
      Dim i As Integer = - 123
      Dim o As [Object] = i
      Dim objs() As [Object] = {-123, -456, -789}
      
      Console.WriteLine("Concatenate 1, 2, and 3 objects:")
      Console.WriteLine("1) {0}", [String].Concat(o))
      Console.WriteLine("2) {0}", [String].Concat(o, o))
      Console.WriteLine("3) {0}", [String].Concat(o, o, o))
      
      Console.WriteLine(vbCrLf & "Concatenate 4 objects and a variable length parameter list:")
      Console.WriteLine("4) {0}", String.Concat(o, o, o, o))
      Console.WriteLine("5) {0}", String.Concat(o, o, o, o, o))
      
      Console.WriteLine(vbCrLf & "Concatenate a 3-element object array:")
      Console.WriteLine("6) {0}", [String].Concat(objs))
   End Sub
End Class
'The example displays the following output:
'    Concatenate 1, 2, and 3 objects:
'    1) -123
'    2) -123-123
'    3) -123-123-123
'    
'    Concatenate 4 objects and a variable length parameter list:
'    4) -123-123-123-123
'    5) -123-123-123-123-123
'         
'    Concatenate a 3-element object array:
'    6) -123-456-789

Remarks

합니다 Concat(Object) 메서드를 나타냅니다 arg0 는 매개 변수가 없는 호출 하 여 문자열로 ToString 메서드.The Concat(Object) method represents arg0 as a string by calling its parameterless ToString method.

See Also

Concat(IEnumerable<String>) Concat(IEnumerable<String>) Concat(IEnumerable<String>) Concat(IEnumerable<String>)

IEnumerable<T> 형식의 생성된 String 컬렉션의 멤버를 연결합니다. Concatenates the members of a constructed IEnumerable<T> collection of type String.

public:
 static System::String ^ Concat(System::Collections::Generic::IEnumerable<System::String ^> ^ values);
[System.Runtime.InteropServices.ComVisible(false)]
public static string Concat (System.Collections.Generic.IEnumerable<string> values);
static member Concat : seq<string> -> string
Public Shared Function Concat (values As IEnumerable(Of String)) As String

매개 변수

values
IEnumerable<String>

IEnumerable<T>을 구현하고 제네릭 형식 인수가 String인 컬렉션 개체입니다. A collection object that implements IEnumerable<T> and whose generic type argument is String.

Returns

values의 연결된 문자열이거나, values가 빈 IEnumerable(Of String)이면 Empty입니다. The concatenated strings in values, or Empty if values is an empty IEnumerable(Of String).

Exceptions

Examples

다음 예에서는 소수 100 보다 작거나를 계산 하는 에라토스테네스의 체 알고리즘을 사용 합니다.The following example uses the Sieve of Eratosthenes algorithm to calculate the prime numbers that are less than or equal to 100. 결과를 할당 한 List<T> 형식의 개체 String에 전달 되는 Concat(IEnumerable<String>) 메서드.It assigns the result to a List<T> object of type String, which it then passes to the Concat(IEnumerable<String>) method.

using System;
using System.Collections.Generic;

public class Example
{
   public static void Main()
   {
      int maxPrime = 100;
      IEnumerable<String> primeList = GetPrimes(maxPrime);
      Console.WriteLine("Primes less than {0}:", maxPrime);
      Console.WriteLine("   {0}", String.Concat(primeList));
   }

   private static IEnumerable<String> GetPrimes(int maxPrime)
   {
      Array values = Array.CreateInstance(typeof(int), 
                              new int[] { maxPrime - 1}, new int[] { 2 }); 
      // Use Sieve of Erathsthenes to determine prime numbers.
      for (int ctr = values.GetLowerBound(0); ctr <= (int) Math.Ceiling(Math.Sqrt(values.GetUpperBound(0))); ctr++)
      {
                           
         if ((int) values.GetValue(ctr) == 1) continue;
         
         for (int multiplier = ctr; multiplier <=  maxPrime / 2; multiplier++)
            if (ctr * multiplier <= maxPrime)
               values.SetValue(1, ctr * multiplier);
      }      
      
      List<String> primes = new List<String>();
      for (int ctr = values.GetLowerBound(0); ctr <= values.GetUpperBound(0); ctr++)
         if ((int) values.GetValue(ctr) == 0) 
            primes.Add(ctr.ToString() + " ");
      return primes;
   }   
}
// The example displays the following output:
//    Primes less than 100:
//       2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
Imports System.Collections.Generic

Module Example
   Public Sub Main()
      Dim maxPrime As Integer = 100
      Dim primeList As IEnumerable(Of String) = GetPrimes(maxPrime)
      Console.WriteLine("Primes less than {0}:", maxPrime)
      Console.WriteLine("   {0}", String.Concat(primeList))
   End Sub
   
   Private Function GetPrimes(maxPrime As Integer) As IEnumerable(Of String)
      Dim values As Array = Array.CreateInstance(GetType(Integer), _
                              New Integer() { maxPrime - 1}, New Integer(){ 2 }) 
      ' Use Sieve of Erathsthenes to determine prime numbers.
      For ctr As Integer = values.GetLowerBound(0) To _
                           CInt(Math.Ceiling(Math.Sqrt(values.GetUpperBound(0))))
         If CInt(values.GetValue(ctr)) = 1 Then Continue For
         
         For multiplier As Integer = ctr To maxPrime \ 2
            If ctr * multiplier <= maxPrime Then values.SetValue(1, ctr * multiplier)
         Next   
      Next      
      
      Dim primes As New List(Of String)
      For ctr As Integer = values.GetLowerBound(0) To values.GetUpperBound(0)
         If CInt(values.GetValue(ctr)) = 0 Then primes.Add(ctr.ToString() + " ")
      Next            
      Return primes
   End Function   
End Module
' The example displays the following output:
'    Primes less than 100:
'       2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

Remarks

각 개체에 연결 하는 메서드 values; 구분 기호를 추가 하지 않습니다.The method concatenates each object in values; it does not add any delimiters. 각 멤버 사이 구분 기호를 지정 하려면 values를 호출 합니다 Join(String, IEnumerable<String>) 메서드.To specify a delimiter between each member of values, call the Join(String, IEnumerable<String>) method.

Empty 문자열에 있는 모든 null 요소 대신 사용 됩니다 values합니다.An Empty string is used in place of any null element in values.

하는 경우 valuesIEnumerable(Of String), 메서드가 반환 String.Empty합니다.If values is an empty IEnumerable(Of String), the method returns String.Empty. 하는 경우 values 됩니다 null, 메서드에서 throw는 ArgumentNullException 예외입니다.If values is null, the method throws an ArgumentNullException exception.

Concat(IEnumerable<String>) 각 요소에 연결할 수 있는 메서드는 IEnumerable(Of String) 문자열 배열에 첫 번째 요소를 변환 하지 않고 컬렉션입니다.Concat(IEnumerable<String>) is a convenience method that lets you concatenate each element in an IEnumerable(Of String) collection without first converting the elements to a string array. LINQ (Language-Integrated Query) 쿼리 식을 사용 하 여 특히 유용합니다.It is particularly useful with Language-Integrated Query (LINQ) query expressions. 다음 예제에서는 전달 된 List(Of String) 알파벳 문자를 특정 문자 (예에서는 "M") 보다 크거나 같은 선택 하는 람다 식으로 대 / 소문자 구분 문자를 포함 하는 개체입니다.The following example passes a List(Of String) object that contains either the uppercase or lowercase letters of the alphabet to a lambda expression that selects letters that are equal to or greater than a particular letter (which, in the example, is "M"). IEnumerable(Of String) 에서 반환 되는 컬렉션 합니다 Enumerable.Where 메서드에 전달 됩니다는 Concat(IEnumerable<String>) 단일 문자열로 결과 표시 하는 방법.The IEnumerable(Of String) collection that is returned by the Enumerable.Where method is passed to the Concat(IEnumerable<String>) method to display the result as a single string.

using System;
using System.Collections.Generic;
using System.Linq;

public class Example
{
   public static void Main()
   {
      string output = String.Concat( GetAlphabet(true).Where( letter => 
                      letter.CompareTo("M") >= 0));
      Console.WriteLine(output);  
   }

   private static List<string> GetAlphabet(bool upper)
   {
      List<string> alphabet = new List<string>();
      int charValue = upper ? 65 : 97;
      for (int ctr = 0; ctr <= 25; ctr++)
         alphabet.Add(Convert.ToChar(charValue + ctr).ToString());
      return alphabet; 
   }
}
// The example displays the following output:
//      MNOPQRSTUVWXYZ
Imports System.Collections.Generic
Imports System.Linq

Module modMain
   Public Sub Main()
      Dim output As String = String.Concat(GetAlphabet(true).Where(Function(letter) _
                                                         letter >= "M"))
        
      Console.WriteLine(output)                                     
   End Sub
   
   Private Function GetAlphabet(upper As Boolean) As List(Of String)
      Dim alphabet As New List(Of String)
      Dim charValue As Integer = CInt(IIf(upper, 65, 97))
      For ctr As Integer = 0 To 25
         alphabet.Add(ChrW(charValue + ctr).ToString())
      Next
      Return alphabet 
   End Function
End Module
' The example displays the following output:
'       MNOPQRSTUVWXYZ

Concat(Object, Object) Concat(Object, Object) Concat(Object, Object) Concat(Object, Object)

지정된 두 개체의 문자열 표현을 연결합니다. Concatenates the string representations of two specified objects.

public:
 static System::String ^ Concat(System::Object ^ arg0, System::Object ^ arg1);
public static string Concat (object arg0, object arg1);
static member Concat : obj * obj -> string
Public Shared Function Concat (arg0 As Object, arg1 As Object) As String

매개 변수

arg0
Object Object Object Object

연결할 첫 번째 개체입니다. The first object to concatenate.

arg1
Object Object Object Object

연결할 두 번째 개체입니다. The second object to concatenate.

Returns

arg0arg1 값의 연결된 문자열 표현입니다. The concatenated string representations of the values of arg0 and arg1.

Examples

다음 예제는 Concat 메서드.The following example demonstrates the Concat method.

using namespace System;

int main()
{
   int i = -123;
   Object^ o = i;
   array<Object^>^objs = { -123, -456, -789};
   Console::WriteLine("Concatenate 1, 2, and 3 objects:");
   Console::WriteLine("1) {0}", String::Concat(o));
   Console::WriteLine("2) {0}", String::Concat(o, o));
   Console::WriteLine("3) {0}", String::Concat(o, o, o));
   
   Console::WriteLine("\nConcatenate 4 objects and a variable length parameter list:" );
   Console::WriteLine("4) {0}", String::Concat(o, o, o, o));
   Console::WriteLine("5) {0}", String::Concat( o, o, o, o, o));
   Console::WriteLine("\nConcatenate a 3-element object array:");
   Console::WriteLine("6) {0}", String::Concat(objs));
}
// The example displays the following output:
//    Concatenate 1, 2, and 3 objects:
//    1) -123
//    2) -123-123
//    3) -123-123-123
//    
//    Concatenate 4 objects and a variable length parameter list:
//    4) -123-123-123-123
//    5) -123-123-123-123-123
//    
//    Concatenate a 3-element object array:
//    6) -123-456-789
using System;

class stringConcat5 {
    public static void Main() {
    int i = -123;
    Object o = i;
    Object[] objs = new Object[] {-123, -456, -789};

    Console.WriteLine("Concatenate 1, 2, and 3 objects:");
    Console.WriteLine("1) {0}", String.Concat(o));
    Console.WriteLine("2) {0}", String.Concat(o, o));
    Console.WriteLine("3) {0}", String.Concat(o, o, o));

    Console.WriteLine("\nConcatenate 4 objects and a variable length parameter list:");
    Console.WriteLine("4) {0}", String.Concat(o, o, o, o));
    Console.WriteLine("5) {0}", String.Concat(o, o, o, o, o));

    Console.WriteLine("\nConcatenate a 3-element object array:");
    Console.WriteLine("6) {0}", String.Concat(objs));
    }
}
// The example displays the following output:
//    Concatenate 1, 2, and 3 objects:
//    1) -123
//    2) -123-123
//    3) -123-123-123
//    
//    Concatenate 4 objects and a variable length parameter list:
//    4) -123-123-123-123
//    5) -123-123-123-123-123
//    
//    Concatenate a 3-element object array:
//    6) -123-456-789
Class stringConcat5
   Public Shared Sub Main()
      Dim i As Integer = - 123
      Dim o As [Object] = i
      Dim objs() As [Object] = {-123, -456, -789}
      
      Console.WriteLine("Concatenate 1, 2, and 3 objects:")
      Console.WriteLine("1) {0}", [String].Concat(o))
      Console.WriteLine("2) {0}", [String].Concat(o, o))
      Console.WriteLine("3) {0}", [String].Concat(o, o, o))
      
      Console.WriteLine(vbCrLf & "Concatenate 4 objects and a variable length parameter list:")
      Console.WriteLine("4) {0}", String.Concat(o, o, o, o))
      Console.WriteLine("5) {0}", String.Concat(o, o, o, o, o))
      
      Console.WriteLine(vbCrLf & "Concatenate a 3-element object array:")
      Console.WriteLine("6) {0}", [String].Concat(objs))
   End Sub
End Class
'The example displays the following output:
'    Concatenate 1, 2, and 3 objects:
'    1) -123
'    2) -123-123
'    3) -123-123-123
'    
'    Concatenate 4 objects and a variable length parameter list:
'    4) -123-123-123-123
'    5) -123-123-123-123-123
'         
'    Concatenate a 3-element object array:
'    6) -123-456-789

Remarks

메서드를 연결 arg0 하 고 arg1 매개 변수가 없는 호출 하 여 ToString 메서드의 arg0arg1; 구분 기호를 추가 하지 않습니다.The method concatenates arg0 and arg1 by calling the parameterless ToString method of arg0 and arg1; it does not add any delimiters.

String.Empty null 인수 대신 사용 됩니다.String.Empty is used in place of any null argument.

경우 인수는 배열 참조, 해당 멤버 (예를 들어, "System.String[]") 대신 해당 배열을 나타내는 문자열을 연결 하는 메서드 중 하나.If either of the arguments is an array reference, the method concatenates a string representing that array, instead of its members (for example, "System.String[]").

See Also

Concat<T>(IEnumerable<T>) Concat<T>(IEnumerable<T>) Concat<T>(IEnumerable<T>) Concat<T>(IEnumerable<T>)

IEnumerable<T> 구현의 멤버를 연결합니다. Concatenates the members of an IEnumerable<T> implementation.

public:
generic <typename T>
 static System::String ^ Concat(System::Collections::Generic::IEnumerable<T> ^ values);
[System.Runtime.InteropServices.ComVisible(false)]
public static string Concat<T> (System.Collections.Generic.IEnumerable<T> values);
static member Concat : seq<'T> -> string
Public Shared Function Concat(Of T) (values As IEnumerable(Of T)) As String

Type Parameters

T

멤버의 형식을 합니다. The type of the members of values.

매개 변수

values
IEnumerable<T> IEnumerable<T> IEnumerable<T> IEnumerable<T>

IEnumerable<T> 인터페이스를 구현하는 컬렉션 개체입니다. A collection object that implements the IEnumerable<T> interface.

Returns

values의 연결된 멤버입니다. The concatenated members in values.

Exceptions

Examples

다음 예제에서는 간단한 정의 Animal animal과 속한 주문의 이름을 포함 하는 클래스입니다.The following example defines a very simple Animal class that contains the name of an animal and the order to which it belongs. 그런 다음 정의 List<T> 개체의 번호를 포함 하도록 Animal 개체입니다.It then defines a List<T> object to contain a number of Animal objects. Enumerable.Where 추출에 확장 메서드를 호출 합니다 Animal 갖는 개체 Order 속성이 같으면 "바위"입니다.The Enumerable.Where extension method is called to extract the Animal objects whose Order property equals "Rodent". 결과에 전달 되는 Concat<T>(IEnumerable<T>) 메서드 및 콘솔에 표시 합니다.The result is passed to the Concat<T>(IEnumerable<T>) method and displayed to the console.

using System;
using System.Collections.Generic;
using System.Linq;

public class Animal
{
   public string Kind;
   public string Order;
   
   public Animal(string kind, string order)
   {
      this.Kind = kind;
      this.Order = order;
   }
   
   public override string ToString()
   {
      return this.Kind;
   }
}

public class Example
{
   public static void Main()
   {
      List<Animal> animals = new List<Animal>();
      animals.Add(new Animal("Squirrel", "Rodent"));
      animals.Add(new Animal("Gray Wolf", "Carnivora"));
      animals.Add(new Animal("Capybara", "Rodent"));
      string output = String.Concat(animals.Where( animal => 
                      (animal.Order == "Rodent")));
      Console.WriteLine(output);  
   }
}
// The example displays the following output:
//      SquirrelCapybara
Imports System.Collections.Generic

Public Class Animal
   Public Kind As String
   Public Order As String
   
   Public Sub New(kind As String, order As String)
      Me.Kind = kind
      Me.Order = order
   End Sub
   
   Public Overrides Function ToString() As String
      Return Me.Kind
   End Function
End Class

Module Example
   Public Sub Main()
      Dim animals As New List(Of Animal)
      animals.Add(New Animal("Squirrel", "Rodent"))
      animals.Add(New Animal("Gray Wolf", "Carnivora"))
      animals.Add(New Animal("Capybara", "Rodent")) 
      Dim output As String = String.Concat(animals.Where(Function(animal) _
                                           animal.Order = "Rodent"))
      Console.WriteLine(output)                                           
   End Sub
End Module
' The example displays the following output:
'      SquirrelCapybara

Remarks

각 개체에 연결 하는 메서드 values; 구분 기호를 추가 하지 않습니다.The method concatenates each object in values; it does not add any delimiters.

Empty 문자열이 null 인수 대신 사용 됩니다.An Empty string is used in place of any null argument.

Concat<T>(IEnumerable<T>) 각 요소에 연결할 수 있는 메서드는 IEnumerable<T> 문자열에 첫 번째 요소를 변환 하지 않고 컬렉션입니다.Concat<T>(IEnumerable<T>) is a convenience method that lets you concatenate each element in an IEnumerable<T> collection without first converting the elements to strings. 예제와 같이 것 LINQ (Language-Integrated Query) 쿼리 식을 사용 하 여 특히 유용 합니다.It is particularly useful with Language-Integrated Query (LINQ) query expressions, as the example illustrates. 각 개체의 문자열 표현 합니다 IEnumerable<T> 컬렉션 개체를 호출 하 여 파생 된 ToString 메서드.The string representation of each object in the IEnumerable<T> collection is derived by calling that object's ToString method.

Applies to