Ref argument is not Classified as a Variable - better fix for this?
<p>I have this piece of code that was converted from VB.NET.</p>

<pre><code>    private static void PrivateExecuteNonQuery(ref Providers enumProvider, ref string statement, ref CommandType commandType, ref ArrayList paramCollection, ref IDbConnection conn, ref Int16 CommandTimeout)
    {
        ExecuteSqlServerNonQuery(ref statement, ref commandType, ref paramCollection, ref (SqlConnection)conn, ref CommandTimeout);
    }
</code></pre>

<p>I am getting an error because it's saying the ref (SqlConnection)conn is not in the form of a variable so I guess you can't pass in method params for a ref?</p>

<p>So this seems like a hacky solution to me though:</p>

<pre><code>    private static void PrivateExecuteNonQuery(ref Providers enumProvider, ref string statement, ref CommandType commandType, ref ArrayList paramCollection, ref IDbConnection conn, ref Int16 CommandTimeout)
    {
        SqlConnection sqlConnection = (SqlConnection)conn;

    ExecuteSqlServerNonQuery(ref statement, ref commandType, ref paramCollection, ref sqlConnection, ref CommandTimeout);
    }
</code></pre>

<p>Anyone know of a better way to satisfy this ref or make this cleaner?</p>
