diff --git a/src/Castle.Core/DynamicProxy/ProxyGenerationOptions.cs b/src/Castle.Core/DynamicProxy/ProxyGenerationOptions.cs index a68f8a3a90..78918d34c0 100644 --- a/src/Castle.Core/DynamicProxy/ProxyGenerationOptions.cs +++ b/src/Castle.Core/DynamicProxy/ProxyGenerationOptions.cs @@ -136,15 +136,8 @@ public MixinData MixinData /// is not a delegate type. public void AddDelegateTypeMixin(Type delegateType) { - if (delegateType == null) - { - throw new ArgumentNullException(nameof(delegateType)); - } - - if (!delegateType.IsDelegateType()) - { - throw new ArgumentException("Type must be a delegate type.", nameof(delegateType)); - } + if (delegateType == null) throw new ArgumentNullException(nameof(delegateType)); + if (!delegateType.IsDelegateType()) throw new ArgumentException("Type must be a delegate type.", nameof(delegateType)); AddMixinImpl(delegateType); } @@ -158,25 +151,15 @@ public void AddDelegateTypeMixin(Type delegateType) /// is . public void AddDelegateMixin(Delegate @delegate) { - if (@delegate == null) - { - throw new ArgumentNullException(nameof(@delegate)); - } + if (@delegate == null) throw new ArgumentNullException(nameof(@delegate)); AddMixinImpl(@delegate); } public void AddMixinInstance(object instance) { - if (instance == null) - { - throw new ArgumentNullException("instance"); - } - - if (instance is Type) - { - throw new ArgumentException("You may not mix in types using this method.", nameof(instance)); - } + if (instance == null) throw new ArgumentNullException(nameof(instance)); + if (instance is Type) throw new ArgumentException("You may not mix in types using this method.", nameof(instance)); AddMixinImpl(instance); } diff --git a/src/Castle.Core/DynamicProxy/ProxyUtil.cs b/src/Castle.Core/DynamicProxy/ProxyUtil.cs index b1d215e96b..f47c7f6829 100644 --- a/src/Castle.Core/DynamicProxy/ProxyUtil.cs +++ b/src/Castle.Core/DynamicProxy/ProxyUtil.cs @@ -65,20 +65,9 @@ public static bool TryCreateDelegateToMixin(object proxy, out TDelega /// if the method succeeds; otherwise . public static bool TryCreateDelegateToMixin(object proxy, Type delegateType, out Delegate @delegate) { - if (proxy == null) - { - throw new ArgumentNullException(nameof(proxy)); - } - - if (delegateType == null) - { - throw new ArgumentNullException(nameof(delegateType)); - } - - if (!delegateType.IsDelegateType()) - { - throw new ArgumentException("Type is not a delegate type.", nameof(delegateType)); - } + if (proxy == null) throw new ArgumentNullException(nameof(proxy)); + if (delegateType == null) throw new ArgumentNullException(nameof(delegateType)); + if (!delegateType.IsDelegateType()) throw new ArgumentException("Type is not a delegate type.", nameof(delegateType)); var invokeMethod = delegateType.GetMethod("Invoke"); var proxiedInvokeMethod =