/// <summary>Returns a string representation of this <see cref="T:System.Net.Mime.ContentType" /> object.</summary> /// <returns>A <see cref="T:System.String" /> that contains the current settings for this <see cref="T:System.Net.Mime.ContentType" />.</returns> public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); Encoding enc = (this.CharSet == null) ? Encoding.UTF8 : Encoding.GetEncoding(this.CharSet); stringBuilder.Append(this.MediaType); if (this.Parameters != null && this.Parameters.Count > 0) { foreach (object obj in this.parameters) { DictionaryEntry dictionaryEntry = (DictionaryEntry)obj; if (dictionaryEntry.Value != null && dictionaryEntry.Value.ToString().Length > 0) { stringBuilder.Append("; "); stringBuilder.Append(dictionaryEntry.Key); stringBuilder.Append("="); stringBuilder.Append(ContentType.WrapIfEspecialsExist(ContentType.EncodeSubjectRFC2047(dictionaryEntry.Value as string, enc))); } } } return(stringBuilder.ToString()); }