public void RegisterMimeType (string mimeType, Type type)
{
if (mimeType == null)
throw new ArgumentNullException ("mimeType");
if (type == null)
throw new ArgumentNullException ("type");
mimeType = mimeType.ToLowerInvariant ();
#if PORTABLE || COREFX
var info = type.GetTypeInfo ();
#else
var info = type;
#endif
if (!info.IsSubclassOf (typeof (MessagePart)) &&
!info.IsSubclassOf (typeof (Multipart)) &&
!info.IsSubclassOf (typeof (MimePart)))
throw new ArgumentException ("The specified type must be a subclass of MessagePart, Multipart, or MimePart.", "type");
#if PORTABLE
var ctor = GetConstructor (info, ConstructorArgTypes);
#else
var ctor = type.GetConstructor (ConstructorArgTypes);
#endif
if (ctor == null)
throw new ArgumentException ("The specified type must have a constructor that takes a MimeEntityConstructorArgs argument.", "type");
mimeTypes[mimeType] = ctor;
}