Skip to content

Commit d12cb21

Browse files
committed
Code cleanup
1 parent 2b8bef8 commit d12cb21

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/DotNext/DelegateHelpers.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public static TDelegate CreateOpenDelegate<TDelegate>(Expression<TDelegate> expr
4242
/// <returns>The open delegate representing property setter.</returns>
4343
public static Action<T, TValue> CreateOpenDelegate<T, TValue>(Expression<Func<T, TValue>> properyExpr)
4444
where T : class
45-
=> properyExpr.Body is MemberExpression { Member: PropertyInfo { CanWrite: true } property } ?
46-
property.SetMethod!.CreateDelegate<Action<T, TValue>>() :
47-
throw new ArgumentException(ExceptionMessages.InvalidExpressionTree, nameof(properyExpr));
45+
=> properyExpr.Body is MemberExpression { Member: PropertyInfo { SetMethod: { } setter } }
46+
? setter.CreateDelegate<Action<T, TValue>>()
47+
: throw new ArgumentException(ExceptionMessages.InvalidExpressionTree, nameof(properyExpr));
4848

4949
/// <summary>
5050
/// Creates a factory for closed delegates.
@@ -54,7 +54,7 @@ public static Action<T, TValue> CreateOpenDelegate<T, TValue>(Expression<Func<T,
5454
/// <returns>The factory of closed delegate.</returns>
5555
public static Func<object, TDelegate> CreateClosedDelegateFactory<TDelegate>(Expression<TDelegate> expression)
5656
where TDelegate : Delegate
57-
=> new(GetMethod(expression).CreateDelegate<TDelegate>);
57+
=> GetMethod(expression).CreateDelegate<TDelegate>;
5858

5959
/// <summary>
6060
/// Performs contravariant conversion

0 commit comments

Comments
 (0)