Skip to content

Commit 1db976b

Browse files
committed
不使用反射创建实例
1 parent 4aca88f commit 1db976b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

WebApiClientCore/Implementations/SourceGeneratorHttpApiActivator.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Diagnostics;
44
using System.Linq;
55
using System.Reflection;
6-
using System.Runtime.CompilerServices;
76
using WebApiClientCore.Exceptions;
87
using WebApiClientCore.Internals;
98

@@ -52,9 +51,7 @@ public SourceGeneratorHttpApiActivator(IApiActionDescriptorProvider apiActionDes
5251
.Select(actionInvokerProvider.CreateActionInvoker)
5352
.ToArray();
5453

55-
this.activator = RuntimeFeature.IsDynamicCodeSupported
56-
? LambdaUtil.CreateCtorFunc<IHttpApiInterceptor, ApiActionInvoker[], THttpApi>(proxyClassType)
57-
: (interceptor, invokers) => proxyClassType.CreateInstance<THttpApi>(interceptor, invokers);
54+
this.activator = LambdaUtil.CreateCtorFunc<IHttpApiInterceptor, ApiActionInvoker[], THttpApi>(proxyClassType);
5855
}
5956

6057
/// <summary>

0 commit comments

Comments
 (0)