jos*_*lmt 1 c# reflection win-universal-app
我需要在我的UWP平台中访问Type.GetProperties,但我的Type类滞后于该方法.
在我看来,这是因为我们在UWP中使用的子集方法,但是试图找到信息,我发现:Type.GetProperties()在Release中不起作用,因此该方法确实存在于UWP中.
如果我转到Type的定义,第一行是这样的:
#region Assembly System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// C:\Users\JoséÁngel\.nuget\packages\System.Runtime\4.0.20\ref\dotnet\System.Runtime.dll
#endregion
Run Code Online (Sandbox Code Playgroud)
也许我的nuget配置有问题?
该项目的条件编译符号是:
NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS
Run Code Online (Sandbox Code Playgroud)
我尝试使用和不使用"使用.NET Native工具链编译"选项.
目标是通用Windows
目标版本是:Windows 10(10.0; Build 10586)最小版本是:Windows 10(10.0; Build 10240)
但我也试过Min版本:Windows 10(10.0; Build 10586)
在NuGET中,该项目只有Microsoft.NETCore.UniversalWindowsPlatform v5.0.0
将您的类型添加到.net本机动态列表中,如链接问题的答案中所述,然后使用*yourthing*.GetType().GetTypeInfo().DeclaredProperties
.
https://msdn.microsoft.com/en-us/library/system.reflection.introspectionextensions.gettypeinfo%28v=vs.110%29.aspx https://msdn.microsoft.com/en-us/library/system .reflection.typeinfo%28V = vs.110%29.aspx
有关详细信息,请参阅本文中的反射部分:https://blogs.msdn.microsoft.com/dotnet/2016/02/10/porting-to-net-core/
归档时间: |
|
查看次数: |
1851 次 |
最近记录: |