If the code uses the reader without disposing of it, it won't be explicitly returned to the pool, correct?
That is correct. Change the code to this:
using (IDataReader rdr =
db.ExecSPGetDataReader("dbo.someStoredProcedure", paramList))
{
if (rdr.Read())
{
List<nameValuePair> formValues =
Utils.nameValuePairs(rdr["valuepairs"].ToString());
foreach (nameValuePair nvp in formValues)
{
if (nvp.name.ToLower() == "name")
{
outString = nvp.value;
break;
}
}
}
}
The using
statement will ensure that Dispose
is called.