public override int GetHashCode() { int result = RollForwardAction.GetMethodInfo().GetHashCode() ^ RollForwardAction.GetType().GetHashCode(); if (RollForwardAction.Target != null) { result ^= RuntimeHelpers.GetHashCode(RollForwardAction); } if (RollBackAction != null) { result ^= RollBackAction.GetMethodInfo().GetHashCode() ^ RollBackAction.GetType().GetHashCode(); if (RollBackAction.Target != null) { result ^= RuntimeHelpers.GetHashCode(RollBackAction); } } return(result); }
public override bool Equals(object obj) { if (obj == null || (obj is DelegateModule <TInput, TOutput>) == false) { return(false); } DelegateModule <TInput, TOutput> another = (DelegateModule <TInput, TOutput>)obj; bool forwardEquals = RollForwardAction.GetMethodInfo().Name == another.RollForwardAction.GetMethodInfo().Name && RollForwardAction.Target == another.RollForwardAction.Target; if (forwardEquals == false) { return(false); } if (RollBackAction == null && another.RollBackAction == null) { return(true); } else if (RollBackAction == null && another.RollBackAction != null) { return(false); } else if (RollBackAction != null && another.RollBackAction == null) { return(false); } else { bool equals = RollBackAction.GetMethodInfo().Name == another.RollBackAction.GetMethodInfo().Name && RollBackAction.Target == another.RollBackAction.Target; return(equals); } }