public Rack(ConstantList <char> rack) { this.rack = rack; value = new string(rack.ToArray()); if (value.Length != Size) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Expected {0} letters but got {1} ({2})", Size, value.Length, value)); } }
public void Write() { var sb = new StringBuilder(); sb.AppendFormat("{0}", main); if (extras.Count > 0) { foreach (WordPart extra in extras) { sb.AppendFormat(" [{0}]", extra); } } sb.AppendFormat(" +{0}", string.Join(string.Empty, (from lp in played select lp.Letter).ToArray())); if (pending.Count > 0) { sb.AppendFormat(" [{0}]", new string(pending.ToArray())); } Console.WriteLine(sb); }