If you add an IEnumerable object into a cache (ASP.net cache) will it enumerate the objects and stick it in there?
for example if I have this method psuedocode
IEnumerable<int> getInts()
{
// open DB connection
// execute stored procedure
while (mySqlDataReader.next())
{
yield return mySqlDataReader.getInt();
}
//close db connection
}
and i add whatever returns from that into a cache..what happens? does the entire thing get enumerated so the sql connection can close..or something else?
A similar question, if the IEnumerable<int> is serialized..what happens?
for example if I have this method psuedocode
IEnumerable<int> getInts()
{
// open DB connection
// execute stored procedure
while (mySqlDataReader.next())
{
yield return mySqlDataReader.getInt();
}
//close db connection
}
and i add whatever returns from that into a cache..what happens? does the entire thing get enumerated so the sql connection can close..or something else?
A similar question, if the IEnumerable<int> is serialized..what happens?
