类型不包含“GetProperties"的定义 [英] Type does not contain a definition for 'GetProperties'

查看:23
本文介绍了类型不包含“GetProperties"的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将库项目迁移到 .net 标准,当我尝试使用 System.Reflection API 调用 Type:GetProperties()<时出现以下编译错误/代码>:

I am migrating a library project to a .net standard and I am getting the following compilation error when I try to use the System.Reflection API to call Type:GetProperties():

类型不包含GetProperties"的定义

Type does not contain a definition for 'GetProperties'

这是我的project.json:

{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable"
  },
  "dependencies": {},
  "frameworks": {
    "netstandard1.6": {
      "dependencies": {
        "NETStandard.Library": "1.6.0"
      }
    }
  }
}

我错过了什么?

推荐答案

在撰写本文时,GetProperties() 现在是:

As of writing this, GetProperties() is now:

typeof(Object).GetTypeInfo().DeclaredProperties;

这篇关于类型不包含“GetProperties"的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆