开发者

.NET 4.0 dynamic - Getting more information about members returned from GetDynamicMemberNames

开发者 https://www.devze.com 2023-01-14 18:38 出处:网络
I am getting the members of a dynamic class using the following method: public static IEnumerable<string> GetDynamicMemberNames(this IDynamicMetaObjectProvider dynamicProvider)

I am getting the members of a dynamic class using the following method:

public static IEnumerable<string> GetDynamicMemberNames(this IDynamicMetaObjectProvider dynamicProvider)
{
  DynamicMetaObject metaObject = dynamicProvider.GetM开发者_运维技巧etaObject(Expression.Constant(dynamicProvider));
  return metaObject.GetDynamicMemberNames();
}

How can I now get more information about what the members are? e.g. whether the member is a property or a method, property return types, etc


You can't, I'm afraid. That's all the information which is exposed. In some cases, the same member name could work as both a property and a method - for example, it could return a delegate if you fetch it as a property, but execute the same code if you call it as a method.

0

精彩评论

暂无评论...
验证码 换一张
取 消