/// <summary> /// Adds an attribute to the name. /// </summary> /// <param name="sb">The <see cref="StringBuilder"/> containing the name.</param> /// <param name="type">The type of the attribute.</param> /// <param name="value">The value of the attribute.</param> /// <exception cref="ArgumentNullException"><paramref name="sb"/> is <c>null</c>.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="type"/> is not a valid attribute type.</exception> static void AddAttribute(StringBuilder sb, string type, object value) { if (sb == null) { throw new ArgumentNullException("sb"); } if (false == RdnSequence.IsValidAttributeType(type)) { throw new ArgumentOutOfRangeException("type", type, "The value is not a valid attribute type."); } if (sb.Length > 0) { // Add delimiter sb.Append(","); } sb.Append(type.ToUpper()); sb.Append('='); var escapedValue = RdnSequence.EscapeValue(value); sb.Append(escapedValue); }