icsharpcode / ILSpy

.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
21.45k stars 3.35k forks source link

This code should be improved #427

Closed CreateAndInject closed 7 years ago

CreateAndInject commented 11 years ago

source code: static void Main(string[] args) { IEnumerable col = null; foreach (var ele in col) Console.WriteLine(ele); { string ele = "7"; Console.WriteLine(ele); } }

decompile code: private static void Main(string[] args) { IEnumerable enumerable = null; string value; using (IEnumerator enumerator = enumerable.GetEnumerator()) { while (enumerator.MoveNext()) { value = enumerator.Current; Console.WriteLine(value); } } value = "7"; Console.WriteLine(value); }

If I rename any "ele", ILSpy can work normally.

siegfriedpammer commented 7 years ago

This was likely fixed in the new decompiler engine (which just landed on the master branch).