Join an array of String value in CSharp

Description

The following code shows how to join an array of String value.

Example


  /*from  w ww . j a v a  2 s.  c om*/
    using System;

  public class JoiningStrings
  {
    static void Main(string[] args)
    {
      string MyString = "Hello";
      string MyString2 = "World";
      string JoinedString = MyString + MyString2;

      Console.WriteLine(JoinedString);

      string[] A = new string[2] {"Hello", "World"};
      string Joined = string.Join(" ", A);

      Console.WriteLine(Joined);
    }
  }

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var