dictionary.Keys.First().GetHashCode() == dictionary.Keys.First().GetHashCode()
dictionary.Keys.First() == dictionary.Keys.First()
trueを返すtrue を
返す
何が欠けていますか?辞書がこのオブジェクトを見つけられないのはなぜですか?
辞書の種類: Dictionary<ExceptionWrapper<Exception>, List<int>>
。
ExceptionWrapper.Equals
との実装は次のExceptionWrapper.GetHashCode
とおりです。
public override int GetHashCode() {
return (typeof(TException).FullName + exception.Message + exception.StackTrace).GetHashCode();
}
public override bool Equals(object obj) {
return
obj is ExceptionWrapper<TException>
&& (obj as ExceptionWrapper<TException>).GetHashCode() == GetHashCode();
}