Skip to content

Commit 9aeb238

Browse files
committed
C#: Improve LINQ expression based on review comments.
1 parent 83a8e3b commit 9aeb238

File tree

1 file changed

+2
-3
lines changed
  • csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions

1 file changed

+2
-3
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ImplicitCast.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,12 @@ private void AddOperatorCall(IMethodSymbol method)
4242
private static IMethodSymbol? GetImplicitConversionMethod(ITypeSymbol type, object value) =>
4343
type
4444
.GetMembers()
45-
.Where(m =>
46-
m is IMethodSymbol method &&
45+
.OfType<IMethodSymbol>()
46+
.Where(method =>
4747
method.GetName() == "op_Implicit" &&
4848
method.Parameters.Length == 1 &&
4949
method.Parameters[0].Type.Name == value.GetType().Name
5050
)
51-
.Cast<IMethodSymbol>()
5251
.FirstOrDefault();
5352

5453
// Creates a new generated expression with an implicit cast added, if needed.

0 commit comments

Comments
 (0)