Jurassic.Library.HiddenClassSchema.AddProperties C# (CSharp) Method

AddProperties() public method

Adds multiple properties to the schema.
public AddProperties ( IEnumerable properties ) : HiddenClassSchema
properties IEnumerable The properties to add.
return HiddenClassSchema
        public HiddenClassSchema AddProperties(IEnumerable<PropertyNameAndValue> properties)
        {
            if (this.properties == null)
            {
                var propertyDictionary = new Dictionary<object, SchemaProperty>(properties.Count());
                int nextValueIndex = 0;
                foreach (var property in properties)
                    propertyDictionary.Add(property.Key, new SchemaProperty(nextValueIndex ++, property.Attributes));
                return new HiddenClassSchema(propertyDictionary, nextValueIndex);
            }
            else
            {
                // There are already properties in the schema.  Just add them one by one.
                HiddenClassSchema newSchema = this;
                foreach (var property in properties)
                    newSchema = AddProperty(property.Key, property.Attributes);
                return newSchema;
            }
        }