Hi,
Is it possible to mark a foreach loop code block and convert it to a for loop with ReSharper?
Or with Visual Studio?
Thanks!
Hi,
Is it possible to mark a foreach loop code block and convert it to a for loop with ReSharper?
Or with Visual Studio?
Thanks!
Yep ReShaper can do that. Tested it in VS2010 + R#5
Before:
var a = new int[] {1, 2, 3, 4};
foreach (var i in a)
{
}
After:
var a = new int[] {1, 2, 3, 4};
for (int index = 0; index < a.Length; index++)
{
var i = a[index];
}