diff --git a/analyzers/src/SonarAnalyzer.CSharp/Rules/RedundantInheritanceList.cs b/analyzers/src/SonarAnalyzer.CSharp/Rules/RedundantInheritanceList.cs index a31a30663b7..6f22d0e1066 100644 --- a/analyzers/src/SonarAnalyzer.CSharp/Rules/RedundantInheritanceList.cs +++ b/analyzers/src/SonarAnalyzer.CSharp/Rules/RedundantInheritanceList.cs @@ -145,9 +145,7 @@ private static INamedTypeSymbol CollidingDeclaration(INamedTypeSymbol declaredTy private static bool CanInterfaceBeRemovedBasedOnMembers(INamedTypeSymbol declaredType, INamedTypeSymbol interfaceType) { - var allMembersOfInterface = AllInterfacesAndSelf(interfaceType) - .SelectMany(x => x.GetMembers()) - .ToList(); + var allMembersOfInterface = AllInterfacesAndSelf(interfaceType).SelectMany(x => x.GetMembers()).ToImmutableArray(); if (!allMembersOfInterface.Any()) {