C# Passing 'TYPE' as parameter and then Compare with 'is'
<p>I'm trying to convert the following code to a GENERIC function, by eliminating the need to hardcode my 'control comparison'. any way to achieve this?:)</p>

<pre><code>    private Control getControlByAccessible(string accessDesc, string accessName, Control wrapper)
    {
        foreach (Control ctrl in wrapper.Controls)
        {
            if (ctrl is TextBox)
            if (ctrl.AccessibleDescription == accessDesc &amp;&amp; ctrl.AccessibleName == accessName)
                return ctrl;
        }
        return null;
    }
</code></pre>

<p>This was my first attempt, wasn't yield any result so far.</p>

<pre><code>    private Control getControlByAccessible(string accessDesc, string accessName, Control wrapper, Type aControlType)
    {
        foreach (Control ctrl in wrapper.Controls)
        {
            if (ctrl is aControlType)
            if (ctrl.AccessibleDescription == accessDesc &amp;&amp; ctrl.AccessibleName == accessName)
                return ctrl;
        }
        return null;
    }
</code></pre>
