internal JsonContainerContract(Type underlyingType) : base(underlyingType)
        {
            JsonContainerAttribute cachedAttribute = JsonTypeReflector.GetCachedAttribute <JsonContainerAttribute>(underlyingType);

            if (cachedAttribute != null)
            {
                if (cachedAttribute.ItemConverterType != null)
                {
                    this.ItemConverter = JsonTypeReflector.CreateJsonConverterInstance(cachedAttribute.ItemConverterType, cachedAttribute.ItemConverterParameters);
                }
                this.ItemIsReference           = cachedAttribute._itemIsReference;
                this.ItemReferenceLoopHandling = cachedAttribute._itemReferenceLoopHandling;
                this.ItemTypeNameHandling      = cachedAttribute._itemTypeNameHandling;
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JsonContainerContract"/> class.
        /// </summary>
        /// <param name="underlyingType">The underlying type for the contract.</param>
        internal JsonContainerContract(Type underlyingType)
            : base(underlyingType)
        {
            JsonContainerAttribute jsonContainerAttribute = JsonTypeReflector.GetCachedAttribute <JsonContainerAttribute>(underlyingType);

            if (jsonContainerAttribute != null)
            {
                if (jsonContainerAttribute.ItemConverterType != null)
                {
                    ItemConverter = JsonTypeReflector.CreateJsonConverterInstance(jsonContainerAttribute.ItemConverterType);
                }

                ItemIsReference           = jsonContainerAttribute._itemIsReference;
                ItemReferenceLoopHandling = jsonContainerAttribute._itemReferenceLoopHandling;
                ItemTypeNameHandling      = jsonContainerAttribute._itemTypeNameHandling;
            }
        }