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);
value = value.Normalize(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);
}
}
}