Esempio n. 1
0
        /// <summary>
        /// Rename the all methods in the method group of the given method to the given new name.
        /// </summary>
        public void Rename(NetMethodDefinition method, string newName)
        {
            if (method.Name == newName)
            {
                return;
            }
            var group = method.MethodGroup;

            if (group == null)
            {
                if (method.IsStatic)
                {
                    method.SetName(newName);
                    return;
                }
                if (method.IsConstructor)
                {
                    throw new InvalidOperationException("Constructor cannot be renamed");
                }
                throw new InvalidOperationException("Method has no group");
            }
            foreach (var m in group)
            {
                m.SetName(newName);
            }
        }
Esempio n. 2
0
 public void RenameMethodOnly(NetMethodDefinition method, string newName)
 {
     method.SetName(newName);
 }