Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

String.Concat Method

Concatenates one or more instances of String, or the String representations of the values of one or more instances of Object.

Overload List

Creates the String representation of a specified object.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function Concat(Object) As String
[C#] public static string Concat(object);
[C++] public: static String* Concat(Object*);
[JScript] public static function Concat(Object) : String;

Concatenates the String representations of the elements in a specified Object array.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function Concat(ParamArray Object()) As String
[C#] public static string Concat(params object[]);
[C++] public: static String* Concat(Object*[]);
[JScript] public static function Concat(Object[]) : String;

Concatenates the elements of a specified String array.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function Concat(ParamArray String()) As String
[C#] public static string Concat(params string[]);
[C++] public: static String* Concat(String*[]);
[JScript] public static function Concat(String[]) : String;

Concatenates the String representations of two specified objects.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function Concat(Object, Object) As String
[C#] public static string Concat(object, object);
[C++] public: static String* Concat(Object*, Object*);
[JScript] public static function Concat(Object, Object) : String;

Concatenates two specified instances of String.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function Concat(String, String) As String
[C#] public static string Concat(string, string);
[C++] public: static String* Concat(String*, String*);
[JScript] public static function Concat(String, String) : String;

Concatenates the String representations of three specified objects.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function Concat(Object, Object, Object) As String
[C#] public static string Concat(object, object, object);
[C++] public: static String* Concat(Object*, Object*, Object*);
[JScript] public static function Concat(Object, Object, Object) : String;

Concatenates three specified instances of String.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function Concat(String, String, String) As String
[C#] public static string Concat(string, string, string);
[C++] public: static String* Concat(String*, String*, String*);
[JScript] public static function Concat(String, String, String) : String;

[C++] Concatenates the String representations of three specified objects and a variable-length parameter list. This method is not CLS-compliant.

[C++] public: static String* Concat(Object*, Object*, Object*, Object*, ...);

Concatenates four specified instances of String.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function Concat(String, String, String, String) As String
[C#] public static string Concat(string, string, string, string);
[C++] public: static String* Concat(String*, String*, String*, String*);
[JScript] public static function Concat(String, String, String, String) : String;

Example

[Visual Basic, C#, C++] In the following code example the DataBinding output is generated using this Concat method.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of Concat. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
myDataBindingCollection = DataBindings
myEnumerator = myDataBindingCollection.GetEnumerator()
While myEnumerator.MoveNext()

   myDataBinding2 = CType(myEnumerator.Current, DataBinding)
   Dim dataBindingOutput1, dataBindingOutput2, dataBindingOutput3 As [String]
   dataBindingOutput1 = [String].Concat("The property name is ", myDataBinding2.PropertyName)
   dataBindingOutput2 = [String].Concat("The property type is ", myDataBinding2.PropertyType.ToString(), "-", dataBindingOutput1)
   dataBindingOutput3 = [String].Concat("The expression is ", myDataBinding2.Expression, "-", dataBindingOutput2)
   WriteToFile(dataBindingOutput3)

   myDataBindingExpression2 = [String].Concat("<%#", myDataBinding2.Expression, "%>")
   myStringReplace2 = myDataBinding2.PropertyName.Replace(".", "-")
   myHtmlControlDesignBehavior.SetAttribute(myStringReplace2, myDataBindingExpression2, True)
   Dim index As Integer = myStringReplace2.IndexOf("-"c)
End While ' while loop ends

[C#] 
myDataBindingCollection = DataBindings;
myEnumerator = myDataBindingCollection.GetEnumerator();
while(myEnumerator.MoveNext())
{

   myDataBinding2 = (DataBinding)myEnumerator.Current;
   String dataBindingOutput1,dataBindingOutput2,dataBindingOutput3;
   dataBindingOutput1=String.Concat("The property name is ",myDataBinding2.PropertyName);
   dataBindingOutput2=String.Concat("The property type is ",myDataBinding2.PropertyType.ToString(),"-",dataBindingOutput1);
   dataBindingOutput3=String.Concat("The expression is ",myDataBinding2.Expression,"-",dataBindingOutput2);
   WriteToFile(dataBindingOutput3);
   myDataBindingExpression2 = String.Concat("<%#",myDataBinding2.Expression,"%>");
   myStringReplace2 = myDataBinding2.PropertyName.Replace(".","-");
   myHtmlControlDesignBehavior.SetAttribute(myStringReplace2,myDataBindingExpression2,true);
   int index = myStringReplace2.IndexOf('-');
}// while loop ends

[C++] 
myDataBindingCollection = DataBindings;
myEnumerator = myDataBindingCollection->GetEnumerator();
while(myEnumerator->MoveNext())
{

    myDataBinding2 = dynamic_cast<DataBinding*>(myEnumerator->Current);
    String* dataBindingOutput1;
    String* dataBindingOutput2;
    String* dataBindingOutput3;

    dataBindingOutput1=String::Concat(S"The property name is ", myDataBinding2->PropertyName);
    dataBindingOutput2=String::Concat(S"The property type is ", myDataBinding2->PropertyType->ToString(), S"-",dataBindingOutput1);
    dataBindingOutput3=String::Concat(S"The expression is ", myDataBinding2->Expression,S"-", dataBindingOutput2);
    WriteToFile(dataBindingOutput3);
    myDataBindingExpression2 = String::Concat(S"<%#", myDataBinding2->Expression,S"%>");
    myStringReplace2 = myDataBinding2->PropertyName->Replace(S".",S"-");
    myHtmlControlDesignBehavior->SetAttribute(myStringReplace2, myDataBindingExpression2, true);
    int index = myStringReplace2->IndexOf('-');
}// while loop ends

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

String Class | String Members | System Namespace

Show:
© 2014 Microsoft