Hi,
I have a function in ASP.NET that takes an IDbCommand object as a parameter. Here's the code:
protected int GetRecordCount(IDbCommand m_Command){
int recCount=0;
m_Command.CommandText = GetSelectStatement(true);
recCount = (int)m_Command.ExecuteScalar();
return recCount;
}
if I add the keyword "ref" before the parameter I get a compilation error (saying the types don't match), but it works fine without the ref.
I wanted to pass-by-ref for performance reasons.
Can someone clue me in to why the compiler won't let me do this? THanks for any thoughts.
Jeff
I have a function in ASP.NET that takes an IDbCommand object as a parameter. Here's the code:
protected int GetRecordCount(IDbCommand m_Command){
int recCount=0;
m_Command.CommandText = GetSelectStatement(true);
recCount = (int)m_Command.ExecuteScalar();
return recCount;
}
if I add the keyword "ref" before the parameter I get a compilation error (saying the types don't match), but it works fine without the ref.
I wanted to pass-by-ref for performance reasons.
Can someone clue me in to why the compiler won't let me do this? THanks for any thoughts.
Jeff