YAMP.ParseContext.RenameConstant C# (CSharp) Method

RenameConstant() public method

Renames a constant from the context.
public RenameConstant ( String oldName, String newName ) : ParseContext
oldName String /// The old name of the constant. ///
newName String /// The new name for the constant. ///
return ParseContext
        public ParseContext RenameConstant(String oldName, String newName)
        {
            if (_constants.ContainsKey(oldName))
            {
                var buffer = _constants[oldName];
                _constants.Remove(oldName);
                _constants.Add(newName, buffer);
            }

            return this;
        }

Usage Example

Exemplo n.º 1
0
 /// <summary>
 /// Renames an existing constant (custom or defined).
 /// </summary>
 /// <param name="context">The context of the constant.</param>
 /// <param name="oldName">The old name of the constant.</param>
 /// <param name="newName">The new name for the constant.</param>
 /// <returns>The given context.</returns>
 public static ParseContext RenameConstant(ParseContext context, string oldName, string newName)
 {
     context.RenameConstant(oldName, newName);
     return(context);
 }