#pragma warning disable CS8765 // Nullability of parameters 'name' and 'value' don't match overridden member public override void Add(string name, string value) #pragma warning restore CS8765 { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (value == null) { throw new ArgumentNullException(nameof(value)); } if (name.Length == 0) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name)); } if (value.Length == 0) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(value)), nameof(value)); } MailBnfHelper.ValidateHeaderName(name); // normalize the case of well known headers name = MailHeaderInfo.NormalizeCase(name); value = value.Normalize(NormalizationForm.FormC); InternalAdd(name, value); }
#pragma warning disable CS8765 // Nullability of parameters 'name' and 'value' don't match overridden member public override void Add(string name, string value) #pragma warning restore CS8765 { ArgumentException.ThrowIfNullOrEmpty(name); ArgumentException.ThrowIfNullOrEmpty(value); MailBnfHelper.ValidateHeaderName(name); // normalize the case of well known headers name = MailHeaderInfo.NormalizeCase(name); value = value.Normalize(NormalizationForm.FormC); InternalAdd(name, value); }
public override void Add(string name, string value) { if (Logging.On) { Logging.PrintInfo(Logging.Web, this, "Add", name.ToString() + "=" + value.ToString()); } if (name == null) { throw new ArgumentNullException(nameof(name)); } if (value == null) { throw new ArgumentNullException(nameof(value)); } if (name == string.Empty) { throw new ArgumentException(SR.GetString(SR.net_emptystringcall, nameof(name)), nameof(name)); } if (value == string.Empty) { throw new ArgumentException(SR.GetString(SR.net_emptystringcall, nameof(value)), nameof(value)); } MailBnfHelper.ValidateHeaderName(name); // normalize the case of well known headers name = MailHeaderInfo.NormalizeCase(name); MailHeaderID id = MailHeaderInfo.GetID(name); value = value.Normalize(Text.NormalizationForm.FormC); if (id == MailHeaderID.ContentType && part != null) { part.ContentType.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else if (id == MailHeaderID.ContentDisposition && part is MimePart) { ((MimePart)part).ContentDisposition.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else { InternalAdd(name, value); } }
#pragma warning disable CS8610 // Nullability of reference types in type of parameter doesn't match overridden member. public override void Add(string name, string value) #pragma warning restore CS8610 { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (value == null) { throw new ArgumentNullException(nameof(value)); } if (name == string.Empty) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name)); } if (value == string.Empty) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(value)), nameof(value)); } MailBnfHelper.ValidateHeaderName(name); // normalize the case of well known headers name = MailHeaderInfo.NormalizeCase(name); MailHeaderID id = MailHeaderInfo.GetID(name); value = value.Normalize(NormalizationForm.FormC); if (id == MailHeaderID.ContentType && _part != null) { _part.ContentType.Set(value.ToLowerInvariant(), this); } else if (id == MailHeaderID.ContentDisposition && _part is MimePart) { ((MimePart)_part).ContentDisposition !.Set(value.ToLowerInvariant(), this); } else { InternalAdd(name, value); } }
public override void Add(string name, string value) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (value == null) { throw new ArgumentNullException(nameof(value)); } if (name == string.Empty) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(name)), nameof(name)); } if (value == string.Empty) { throw new ArgumentException(SR.Format(SR.net_emptystringcall, nameof(value)), nameof(name)); } MailBnfHelper.ValidateHeaderName(name); // normalize the case of well known headers name = MailHeaderInfo.NormalizeCase(name); MailHeaderID id = MailHeaderInfo.GetID(name); // TODO https://github.com/dotnet/corefx/issues/11747: Uncomment once we can use NormalizationForm //value = value.Normalize(Text.NormalizationForm.FormC); if (id == MailHeaderID.ContentType && _part != null) { _part.ContentType.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else if (id == MailHeaderID.ContentDisposition && _part is MimePart) { ((MimePart)_part).ContentDisposition.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else { InternalAdd(name, value); } }
public override void Add(string name, string value) { if (Logging.On) { Logging.PrintInfo(Logging.Web, this, "Add", name.ToString() + "=" + value.ToString()); } if (name == null) { throw new ArgumentNullException("name"); } if (value == null) { throw new ArgumentNullException("value"); } if (name == string.Empty) { throw new ArgumentException(SR.GetString("net_emptystringcall", new object[] { "name" }), "name"); } if (value == string.Empty) { throw new ArgumentException(SR.GetString("net_emptystringcall", new object[] { "value" }), "name"); } MailBnfHelper.ValidateHeaderName(name); name = MailHeaderInfo.NormalizeCase(name); MailHeaderID iD = MailHeaderInfo.GetID(name); if ((iD == MailHeaderID.ContentType) && (this.part != null)) { this.part.ContentType.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else if ((iD == MailHeaderID.ContentDisposition) && (this.part is MimePart)) { ((MimePart)this.part).ContentDisposition.Set(value.ToLower(CultureInfo.InvariantCulture), this); } else { this.InternalAdd(name, value); } }