Browse Source

#3209: Only add imports for extension methods.

pull/3198/merge
Siegfried Pammer 11 months ago
parent
commit
6c08851cb0
  1. 2
      ICSharpCode.Decompiler/CSharp/Transforms/IntroduceUsingDeclarations.cs

2
ICSharpCode.Decompiler/CSharp/Transforms/IntroduceUsingDeclarations.cs

@ -130,7 +130,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -130,7 +130,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
public override void VisitForeachStatement(ForeachStatement foreachStatement)
{
var annotation = foreachStatement.Annotation<ForeachAnnotation>();
if (annotation?.GetEnumeratorCall is CallInstruction { Method.DeclaringType: var type })
if (annotation?.GetEnumeratorCall is CallInstruction { Method: { IsExtensionMethod: true, DeclaringType: var type } })
{
AddImportedNamespace(type);
}

Loading…
Cancel
Save