Why is the following 'exist' boolean variable getting a value of false???
foreach (Cell existCell in this.decoratorByCell.Keys)
{
//this call yield the same hashcode for both cells. still exist==false
bool exist =
this.decoratorByCell.ContainsKey(existCell);
}
I've overridden GetHashCode() & Equals() Methods as follows:
public override int GetHashCode()
{
string nodePath = GetNodePath();
return nodePath.GetHashCode() + m_ownerColumn.GetHashCode();
}
public bool Equals(Cell other)
{
bool nodesEqual = (other.OwnerNode == null && this.OwnerNode == null) || (other.GetNodePath() == this.GetNodePath());
bool columnsEqual = (other.OwnerColumn == null && this.OwnerColumn == null) || (other.OwnerColumn == this.OwnerColumn);
bool treesEqual = (this.m_ownerTree == other.m_ownerTree);
return (nodesEqual && columnsEqual && treesEqual);
}