Exemple #1
0
 /// <summary>
 /// Joins the <paramref name="chars"/> with <paramref name="separator"/> into a string.
 /// </summary>
 /// <param name="chars">The <see cref="Char[]"/> to join.</param>
 /// <param name="separator">The <see cref="Char"/> to interleave.</param>
 /// <returns>The joined <see cref="String"/>.</returns>
 public static String Join(this Char[] chars, Char separator)
 {
     if (chars is null)
     {
         throw new ArgumentNullException(nameof(chars));
     }
     Char[] Result = new Char[(chars.Length * 2) - 1];
     for (Int32 i = 0; i < (chars.Length * 2) - 1; i++)
     {
         Result[i] = i % 2 == 0 ? chars[i / 2] : separator;
     }
     return(Result.Join());
 }