Is there a best practice for iterations inside of a "using"? which is better? and maybe a why?
"using" inside of an iteration...
foreach (var currentPerson in Persons)
{
using (var db = new SolutionModel())
{
//TODO: run query
}
}
or is it better to do an iteration inside of a "using"...
using (var db = new SolutionModel())
{
foreach (var currentPerson in Persons)
{
//TODO: run query
}
}
FYI: coding in C#