should calling indexof call Equals?
<p>I have a List &lt; MyObj > </p>

<p>I have also overriden Equals(Object) in class MyObj.</p>

<p>When I call indexof on my list it does not get any index and equals is not called.</p>

<p>Is my assumption correct that Equals(Object) should be called when I call index of ?</p>

<p>If not how do I find MyObj objects if I do not have exact reference but objects are logically same,,,?</p>

<p>here is the code I am using </p>

<pre><code> public class TreeNode&lt;T&gt;
    {
        private readonly List&lt;TreeNode&lt;T&gt;&gt; _children = new List&lt;TreeNode&lt;T&gt;&gt;();     

        public TreeNode(T value)
        {
            Value = value;
        }

        public virtual bool Equals(Object obj)
        {
            TreeNode&lt;T&gt; treeNode = (TreeNode&lt;T&gt;)obj;

            if (treeNode.Value.Equals(Value))
                return true;
            else
                return false;
        }


        public TreeNode&lt;T&gt; this[int i]
        {
            get { return _children[i]; }
        }

        public TreeNode&lt;T&gt; Parent { get; private set; }
        public T Value { get; set; }

        public ReadOnlyCollection&lt;TreeNode&lt;T&gt;&gt; Children
        {
            get { return _children.AsReadOnly(); }
        }

        public TreeNode&lt;T&gt; AddChild(T value)
        {
            var node = new TreeNode&lt;T&gt;(value) { Parent = this };
            _children.Add(node);
            return node;
        }

        public bool RemoveChild(TreeNode&lt;T&gt; node)
        {
            return _children.Remove(node);
        }

        public void Traverse(Action&lt;T&gt; action)
        {
            action(Value);
            foreach (var child in _children)
                child.Traverse(action);
        }


    }
</code></pre>

<p>this is how I am call the collection </p>

<pre><code>  int artistIndex = serverDirs.Children.IndexOf(new TreeNode&lt;String&gt;(artist));
</code></pre>

<p>in the index returned in always -1 even though the item is there in the children 
Thanks,</p>
