protected virtual bool AddTypeToKnownTypesIfSerializable(Type typeToAdd, XmlSerializerTypeInfo serializerTypeInfo)
{
// Collection first, this collection of types is smaller so if we have a hit, we exit sooner
if (serializerTypeInfo.IsCollectionAlreadyHandled(typeToAdd))
{
return true;
}
if (serializerTypeInfo.ContainsKnownType(typeToAdd))
{
return true;
}
serializerTypeInfo.AddCollectionAsHandled(typeToAdd);
// If this is a special collection type (generic), then we need to make sure that if the inner type is
// an interface, we do not add it again if already added.
// See this issue http://catel.codeplex.com/workitem/7167
if (serializerTypeInfo.IsSpecialCollectionType(typeToAdd))
{
// Always ignore
return false;
}
return serializerTypeInfo.AddKnownType(typeToAdd);
}