为什么在C#中调用构造函数/函数时,我需要在某个时候明确特定通用类型?
请参考上图,我们可以看到abpasyncdeterminiation Interpector
必须具有与其构造函数中提供的通用类型相同。假定应该自动解释它,而不是明确指定new abpasyncdeterminiationInterceptor< blueprintInterceptor>(new BluePrintInterceptor());
>指定通用类型,该函数可以从参数类型揭示返回类型。
提前致谢。
Refer to the image above, we can see the AbpAsyncDeterminiationInterceptor
must have a generic type which is the same as what is provided into its constructor. Supposed it should be interpreted automatically instead of explicitly specifies something like new AbpAsyncDeterminiationInterceptor<BlueprintInterceptor>(new BlueprintInterceptor());
The weird point is that, sometimes when I call a function, I won't need to specify the generic type and the function could reveal the return type from the parameter type.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论