Know your language – C#
If you are still doing the following:
Then know that since C# 1.0 you could write it as:
for (int i = 0; (i < CommandCollection.Length); i++)
{
//...
}
or you could enumerate over the collection, in this case CommandCollection is an array of SqlCommand:
foreach (SqlCommand cmd in CommandCollection)
{
//...
}
Or you could use a ForEach action:
Array.ForEach(CommandCollection, cmd =>
{
//...
});
Comments