Join Strings - CSharp System

CSharp examples for System:String Join

Description

Join Strings

Demo Code


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

public class Main{
        public static string JoinStrings(this IEnumerable<string> strings, string separator)
        {// w w  w . ja  v  a2s .  c  o m
            return string.Join(separator, strings.ToArray());
        }
        public static string JoinStrings(this IEnumerable<string> strings)
        {
            return strings.SelectMany(s => s).AsString();
        }
        public static string AsString(this IEnumerable<char> chars)
        {
            return new string(chars.ToArray());
        }
}

Related Tutorials