String Join C# | C# join string - c# - c# tutorial - c# net




C# Join String

Learn c# - c# tutorial - C# Join String - c# examples - c# programs

What is C# join string ?

  • The join string() method combines many strings into one. The join string receives two arguments, such as:
    • An array of IEnumerable and
    • A separator string.
  • It places the separator between every element of the collection in the returned string.
 C#  join string

C# join string

Syntax:

string str = String.Join("string name")
click below button to copy the code. By - c# tutorial - team

C# Sample Code - C# Examples:

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

namespace wikitechy_join_string
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] strjoin = new string[]{"Welcome to wikitechy 
            web site","www.wikitechy.com",
            "This is string join Method"};
     
            string str = String.Join("\n", strjoin);
   
            Console.WriteLine(str);

            Console.ReadLine();
        }
    } 
}
click below button to copy the code. By - c# tutorial - team

Code Explanation:

 c sharp string join list
  1. In this example we combine string elements from an array into a new, single string (string[] strjoin = new string[]) with dividing 3 characters (Welcome to wikitechy web site","www.wikitechy.com","This is string join Method"). This example will produce the output with separating commas.
  2. Here we use the string.Join method to combine a List of strings into one string.
  3. It Writes the string representation of the specified str object, followed by the current line terminator, to the standard output stream using the specified format information.

Sample C# examples - Output :

 c sharp string join lists
  1. Here in this output we display "welcome to wikitechy website" which specifies to new string array with first elements.
  2. In this output we display www.wikitechy.com which specifies to new string array with second elements.
  3. In this output we display "This is string join Method" which specifies to new string array with third elements.


Related Searches to String Join C# | C# join string

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×