What's the equivalent to PropertyInfo.Reflecte

2019-07-25 21:06发布

问题:

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

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

回答1:

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...

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).