//inherited/interface methods------------------------------------------------------- public void RenameMethod(string newName) { if (_method.Name.Equals(newName)) { return; } if (!NameValidator.isNameValid(newName)) { throw new ArgumentException("method name is Invalid!"); } var newMethod = _method.Clone() as EventMethodInfo; newMethod.RenameMethod(newName); if (_containingGroup.ContainsMethod(newMethod)) { throw new InvalidOperationException("method exists in group!"); } _containingGroup.ReplaceMethod(_method, newMethod); }
public void ReplaceMethod(EventMethodInfo oldMethod, EventMethodInfo newMethod) { if (IsReadOnly) { throw new MemberAccessException("attribute is read-only (non-Modifiable)!"); } if (oldMethod == null || newMethod == null) { throw new ArgumentException("cannot accept null arguments"); } var index = _methods.FindIndex(oldMethod.Equals); if (index == -1) { throw new ArgumentException("oldMethod was not found"); } if (index != -1) { _methods[index] = newMethod.Clone() as EventMethodInfo; } }
//methods--------------------------------------------------------------------------- public void AddMethod(EventMethodInfo eventMethod) { if (IsReadOnly) { throw new MemberAccessException("attribute is read-only (non-Modifiable)!"); } if (eventMethod == null) { throw new ArgumentException("cannot add a null method"); } if (_methods.Contains(eventMethod)) { throw new ArgumentException("method with the same signature already exits"); } _methods.Add(eventMethod.Clone() as EventMethodInfo); }