Using a subclass method on a base class object
<p>Let's say I have declared the following classes:</p>

<pre><code>class BaseClass{
    /* properties, constructors, getters, setters etc. */

    public static BaseClass Create(string url){
    /*will return, depending on url, a BaseClass or a SubClass object*/
    }

    public void Method(){
    /* some code here */
    }
}

class SubClass: BaseClass{
    /* other properties, constructors, getters, setters etc. */

    new public void Method(){
    /* some other code here */
    }
}
</code></pre>

<p>Now in my Main method I would like to do something along the lines of:</p>

<pre><code>BaseClass baseClass = BaseClass.Create(url);
if(baseClass.GetType()==typeof(SubClass)){ 
    baseClass.Method();
}
</code></pre>

<p>The idea here, of course, is to use <code>Method</code> as it is implemented in <code>SubClass</code>. It may be a silly question but how do I do that? I can't cast a base class into a subclass so I'm not sure...</p>

<h2><strong>EDIT</strong></h2>

<p>Clarified my question. Even though baseClass was declared as a BaseClass instance, <code>baseClass is SubClass</code> will return <code>true</code>if <code>url</code> is such that <code>Create</code> returns a <code>SubClass</code> instance.</p>
