Пример #1
0
        public ConstantDeclaration AddConstant(Type type, string name, SnippetExpression expression)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }
            if (this.constants.Contains(name))
            {
                throw new ArgumentException("field already existing in class");
            }

            ConstantDeclaration c = new ConstantDeclaration(this.Conformer.ToCamel(name), this, type, expression);

            this.constants.Add(c);
            return(c);
        }
        public ConstantDeclaration AddConstant(Type type, string name,SnippetExpression expression)
        {
            if (type==null)
                throw new ArgumentNullException("type");
            if (name==null)
                throw new ArgumentNullException("name");
            if (expression==null)
                throw new ArgumentNullException("expression");
            if (this.constants.Contains(name))
                throw new ArgumentException("field already existing in class");

            ConstantDeclaration c = new ConstantDeclaration(this.Conformer.ToCamel(name),this,type,expression);
            this.constants.Add(c);
            return c;
        }
Пример #3
0
 /// <summary>
 /// Adds an element with the specified key and value to this StringConstantDeclaration.
 /// </summary>
 /// <param name="key">
 /// The String key of the element to add.
 /// </param>
 /// <param name="value">
 /// The ConstantDeclaration value of the element to add.
 /// </param>
 public virtual void Add(ConstantDeclaration value)
 {
     this.Dictionary.Add(value.Name, value);
 }