Is there an alternative to type checking in this C# code?
<p>I'm currently working on a tree structure of nodes where each node should be able to tell if it is equivalent to another one. Each node class is a subclass of QueryNode.
To check for equivalency, nodes compare if they are of the same subclass and have equal member values (of course there's more things involved, but this is the part that bugs me):</p>

<pre><code>class VersionNode : QueryNode
{
    VersionModifier m_versionModifier;

    internal VersionModifier VersionModifier
    { get { return this.m_versionModifier; } }

    // ...

    protected override bool AreMembersEquivalent(QueryNode other)
    {
        VersionNode otherNodeAsVersionNode = other as VersionNode;

        if (otherNodeAsVersionNode == null)
            return false;
        else
            return (this.m_versionModifier == otherNodeAsVersionNode.VersionModifier);
    }
}
</code></pre>

<p>I feel this may not be an optimal solution because it involves casting. Is there a more elegant way to do this?</p>
