.NET Core/.NET Standard 中 PropertyInfo.ReflectedType 的等价物是什么?

编程入门 行业动态 更新时间:2024-10-23 16:25:42
本文介绍了.NET Core/.NET Standard 中 PropertyInfo.ReflectedType 的等价物是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要类似于 PropertyInfo.ReflectedType 在完整框架中所做的事情.

I need something like what PropertyInfo.ReflectedType does in the full framework.

目前我无法弄清楚什么可以替代 PropertyInfo 的整个属性.

For now I've been not able to figure out what can be the alternative to the whole property of PropertyInfo.

推荐答案

ReflectedType 在 .NET Core 中不受支持,正如微软的人所说,它被有意排除".这个 github 上的问题 包含一个博客链接,该链接解释了原因,但现在已损坏...

ReflectedType is not supported in .NET Core and was "intentionally excluded" as guys from Microsoft says. This question on github contains a link to blog that explains the reason but is broken right now...

您可以查看像 Nunit 这样的 PR.消除使用 ReflectedType 为 ASP .Net 5 支持做准备 或 AutoFixture.支持 CoreCLR 以获得如何调整代码的想法.通常,有效的解决方案是删除所有 ReflectedType 属性的使用,而是保留并使用对获取该类型的对象(反射对象)的引用.

You may look on PRs like Nunit. Eliminate use of ReflectedType in preparation for ASP .Net 5 support or AutoFixture. Support for CoreCLR to get ideas how to adapt your code. In general, the working solution is to remove all using of ReflectedType property and instead hold and use the reference to the the object for which the type was got (reflected object).

更多推荐

.NET Core/.NET Standard 中 PropertyInfo.ReflectedType 的等价物是什么?

本文发布于:2023-11-15 08:05:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1592632.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:等价物   Core   NET   Standard   ReflectedType

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!