为什么在C#中调用构造函数/函数时,我需要在某个时候明确特定通用类型?

发布于 2025-02-11 17:10:16 字数 442 浏览 0 评论 0原文

请参考上图,我们可以看到abpasyncdeterminiation Interpector必须具有与其构造函数中提供的通用类型相同。假定应该自动解释它,而不是明确指定new abpasyncdeterminiationInterceptor< blueprintInterceptor>(new BluePrintInterceptor());

>指定通用类型,该函数可以从参数类型揭示返回类型。

提前致谢。

enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文