Catel.Runtime.Serialization.Xml.DataContractSerializerFactory.XmlSerializerTypeInfo.IsSpecialCollectionType C# (CSharp) Метод

IsSpecialCollectionType() публичный Метод

Determines whether the specified type is a special .NET collection type which should be added to the serialization known types. All generic collections in the System.Collections.Generic namespace are considered special. Besides these classes, the ObservableCollection{T} is also considered special.
The is null.
public IsSpecialCollectionType ( Type type ) : bool
type System.Type The type.
Результат bool
            public bool IsSpecialCollectionType(Type type)
            {
                if (_isSpecialCollectionCache.ContainsKey(type))
                {
                    return _isSpecialCollectionCache[type];
                }

                // Check all sub types as well (a type might be deriving from IEnumerable)
                var baseType = type;
                while (baseType != null)
                {
                    if (IsSpecificTypeSpecialCollection(baseType))
                    {
                        // Note: this is not a bug, we need to add type to the collection
                        _isSpecialCollectionCache[type] = true;
                        return true;
                    }

                    baseType = baseType.GetBaseTypeEx();
                }

                var implementedInterfaces = type.GetInterfacesEx();
                foreach (var implementedInterface in implementedInterfaces)
                {
                    if (IsSpecificTypeSpecialCollection(implementedInterface))
                    {
                        // Note: this is not a bug, we need to add type to the collection
                        _isSpecialCollectionCache[type] = true;
                        return true;
                    }
                }

                _isSpecialCollectionCache[type] = false;
                return false;
            }