我有以下对象:
dynamic person = new {Id = 1,Name = "SpiderMan"};
我还需要能够以最有效的方式实现这一点,因此我选择使用FastMember,但它的api不允许我遍历属性.
有任何想法吗?
[UPDATE]
感谢Marc,我成功实现了我想要的用途:
dynamic person = new { Id = 1,Name = "SpiderMan" }; MemberSet members = TypeAccessor.Create(person.GetType()).GetMembers(); foreach (Member item in members) { // do whatever }