icsharpcode/ILSpy

foreach expected but while used instead

Open

#1603 aperta il 29 lug 2019

Vedi su GitHub
 (3 commenti) (0 reazioni) (0 assegnatari)C# (3645 fork)batch import
C#DecompilerEnhancementHelp Wanted

Metriche repository

Star
 (25.162 star)
Metriche merge PR
 (Merge medio 15g 22h) (61 PR mergiate in 30 g)

Descrizione

ILSpy version 5.0.0.4970-preview3

method decompiled with while but foreach expected

protected CompositeDevices(SerializationInfo info, StreamingContext context)
	: base(info, context)
{
	SerializationInfoEnumerator enumerator = info.GetEnumerator();
	while (enumerator.MoveNext())
	{
		string name = enumerator.Current.Name;
		if (name != null && name == "AdditionalParameters")
		{
			AdditionalParameters = (Dictionary<string, string>)info.GetValue("AdditionalParameters", typeof(Dictionary<string, string>));
		}
	}
	base.CollectionChanged += OnCollectionChanged;
}

please also ref to very similar method CompositeDevices(IEnumerable col) that decompiled to foreach!

target: #1601

PS this assemlby has a lot of other locations that are decompiled to while loop instead of much more expected foreach!

Guida contributor