如何获取动态对象的属性和字段?

时间:2018-07-01 02:50:13

标签: c#

我正在尝试解决此问题: https://github.com/GregFinzer/Compare-Net-Objects/issues/103

这不会返回动态属性名称或ID: type.GetProperties()

示例代码:

public class Entity
{
    public Guid Id { get; set; }
    public String Name { get; set; }
}

Delta<Entity> x = new Delta<Entity>();
dynamic dynamicX = x;
dynamicX.Name = nameof(Entity);
dynamicX.Id = typeof(Entity).GUID;

0 个答案:

没有答案