YAMP.ParseContext.SetDefaultProperty C# (CSharp) Method

SetDefaultProperty() public method

Sets a template property in the dictionary.
public SetDefaultProperty ( String binName, String propertyName, Value propertyValue ) : ParseContext
binName String The category of the default property.
propertyName String The name of the property.
propertyValue Value The default value of the property.
return ParseContext
        public ParseContext SetDefaultProperty(String binName, String propertyName, Value propertyValue)
        {
            if (!_defaultProperties.ContainsKey(binName))
                _defaultProperties.Add(binName, new Dictionary<String, Value>());

            var bin = _defaultProperties[binName];

            if (propertyValue != null)
            {
                if (bin.ContainsKey(propertyName))
                    bin[propertyName] = propertyValue;
                else
                    bin.Add(propertyName, propertyValue);
            }
            else if (bin.ContainsKey(propertyName))
                bin.Remove(propertyName);

            return this;
        }