System.Runtime.Serialization.Plists.DataContractBinaryPlistSerializer.DataContractBinaryPlistSerializer C# (CSharp) Method

DataContractBinaryPlistSerializer() public method

Initializes a new instance of the DataContractBinaryPlistSerializer class.
public DataContractBinaryPlistSerializer ( Type type ) : System
type System.Type The type of the instances that are serialized or de-serialized.
return System
        public DataContractBinaryPlistSerializer(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type", "type cannot be null.");
            }

            this.isDictionary = typeof(IDictionary).IsAssignableFrom(type);

            if (!this.isDictionary && type.IsCollection())
            {
                throw new ArgumentException("root type cannot be a collection unless it is an IDictionary implementation.", "type");
            }

            if (type.IsPrimitiveOrEnum())
            {
                throw new ArgumentException("type must be an implementation of IDictionary or a complex object type.", "type");
            }

            this.rootType = type;
            this.typeCache = new Dictionary<Type, TypeCacheItem>();
        }