/// <summary>
        /// Creates properties for the given <see cref="JsonObjectContract"/>.
        /// </summary>
        /// <param name="contract">The contract to create properties for.</param>
        /// <returns>Properties for the given <see cref="JsonObjectContract"/>.</returns>
        protected virtual IList <JsonProperty> CreateProperties(JsonObjectContract contract)
        {
            List <MemberInfo> members = GetSerializableMembers(contract.UnderlyingType);

            if (members == null)
            {
                throw new JsonSerializationException("Null collection of seralizable members returned.");
            }

            JsonPropertyCollection properties = new JsonPropertyCollection();

            foreach (MemberInfo member in members)
            {
                JsonProperty property = CreateProperty(contract, member);

                if (property != null)
                {
                    properties.AddProperty(property);
                }
            }

            return(properties);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JsonObjectContract"/> class.
 /// </summary>
 /// <param name="underlyingType">The underlying type for the contract.</param>
 public JsonObjectContract(Type underlyingType)
     : base(underlyingType)
 {
     Properties = new JsonPropertyCollection();
 }