Skip to content

Commit d1ec908

Browse files
committed
Small optimization
1 parent 655a375 commit d1ec908

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/NHibernate/Linq/ExpressionTransformers/LikeTransformer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal class LikeTransformer : IExpressionTransformer<MethodCallExpression>
1717

1818
public Expression Transform(MethodCallExpression expression)
1919
{
20-
if (expression.Method == ReflectionCache.StringMethods.StartsWith)
20+
if (expression.Method.Name == nameof(string.StartsWith) && expression.Method == ReflectionCache.StringMethods.StartsWith)
2121
{
2222
return Expression.Call(
2323
Like,
@@ -26,7 +26,7 @@ public Expression Transform(MethodCallExpression expression)
2626
);
2727
}
2828

29-
if (expression.Method == ReflectionCache.StringMethods.EndsWith)
29+
if (expression.Method.Name == nameof(string.EndsWith) && expression.Method == ReflectionCache.StringMethods.EndsWith)
3030
{
3131
return Expression.Call(
3232
Like,
@@ -35,7 +35,7 @@ public Expression Transform(MethodCallExpression expression)
3535
);
3636
}
3737

38-
if (expression.Method == ReflectionCache.StringMethods.Contains)
38+
if (expression.Method.Name == nameof(string.Contains) && expression.Method == ReflectionCache.StringMethods.Contains)
3939
{
4040
return Expression.Call(
4141
Like,

0 commit comments

Comments
 (0)