开发者

How to tell if MemberInfo is internal

What is the quick test to determine if an instance of Membe开发者_运维技巧rInfo is internal ?


How to tell if MemberInfo is internal?

You can't because the question doesn't actually make sense.

A member info could be representing a property, and properties do not have an accessibility. (The getter and setter have an accessibility, but since they can be different, the property does not have an accessibility.)

Since there are members that do not have accessibility, there is no way to determine the accessibility of a member just from a MemberInfo. You'll need to turn it into a FieldInfo or TypeInfo or whatever it actually is and then ask that object what the accessibility is. (And of course if it is a PropertyInfo then you'll have to figure out whether you're interested in the getter or the setter and get the method info associated with it.)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜