private void Initialize(Type type,
IEnumerable<Type> knownTypes,
int maxItemsInObjectGraph,
bool ignoreExtensionDataObject,
EmitTypeInformation emitTypeInformation,
bool serializeReadOnlyTypes,
DateTimeFormat dateTimeFormat,
bool useSimpleDictionaryFormat)
{
CheckNull(type, nameof(type));
_rootType = type;
if (knownTypes != null)
{
this.knownTypeList = new List<Type>();
foreach (Type knownType in knownTypes)
{
this.knownTypeList.Add(knownType);
if (knownType != null)
{
AddCollectionItemTypeToKnownTypes(knownType);
}
}
}
if (maxItemsInObjectGraph < 0)
{
throw new ArgumentOutOfRangeException(nameof(maxItemsInObjectGraph), SR.ValueMustBeNonNegative);
}
_maxItemsInObjectGraph = maxItemsInObjectGraph;
_ignoreExtensionDataObject = ignoreExtensionDataObject;
_emitTypeInformation = emitTypeInformation;
_serializeReadOnlyTypes = serializeReadOnlyTypes;
_dateTimeFormat = dateTimeFormat;
_useSimpleDictionaryFormat = useSimpleDictionaryFormat;
}