using System.Text;

namespace ExtensionMethods
{
	/// <summary>
	/// <para>Add extensions to <c><see cref="ushort"/></c></para>
	/// </summary>
	public static class UShortExtensions
	{
		/// <summary>
		/// <para>Concatenates a speceified separator <see cref="string"/> between each element of a specified <see cref="ushort"/> array, yielding a single concatenated string</para>
		/// </summary>
		/// <param name="array"></param>
		/// <param name="separator">A <see cref="string"/></param>
		/// <returns>The concatenated <see cref="string"/></returns>
		public static string Join(this ushort[] array, string separator)
		{
			StringBuilder concat = new StringBuilder();
			bool notFirst = false;
			foreach (ushort item in array)
			{
				if (notFirst)
					concat.Append(separator);
				else
					notFirst = true;
				concat.Append(item);
			}
			return concat.ToString();
		}
	}
}