public void Export(ICollection<Type> types)
{
if (types == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(types)));
TraceExportBegin();
DataContractSet oldValue = (_dataContractSet == null) ? null : new DataContractSet(_dataContractSet);
try
{
foreach (Type type in types)
{
if (type == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.Format(SR.CannotExportNullType, nameof(types))));
AddType(type);
}
Export();
}
catch (Exception ex)
{
if (DiagnosticUtility.IsFatal(ex))
{
throw;
}
_dataContractSet = oldValue;
TraceExportError(ex);
throw;
}
TraceExportEnd();
}