如何使用reflector查看.NET库函数的实现
我试图查看 [MethodImpl(MethodImplOptions.InternalCall)] 的实现 public extern int get_Length();
函数,它又是字符串的 Length 属性。
但 Reflector 给了我以下错误:
该成员未加载或可能由于您的可见性设置而被隐藏
但是该成员已加载且可见性设置为“全部”
I tried to see the implementation of [MethodImpl(MethodImplOptions.InternalCall)]
function, which in turn is Length property of string.
public extern int get_Length();
But reflector gave me the following error:
The member is not loaded or may be hidden due to your visibility settings
However the member is loaded and the visibility settings is ALL
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信外部方法是“通常”使用其他 DLL 实现的方法,大多数是本机的。 当然,在这种情况下,您就脱离了反射地盘!
I belive the extern methods are the ones that are "typically" implemented using other DLLs, mostly native ones. And of course, when that is the case you are out of the reflection turf!
某些非常重要的类型(例如
String
)有许多使用本机代码实现的方法。String
的Length
属性就是一个这样的例子。 这也可以从extern
修饰符看出。 Reflector无法向您展示这些方法的实现。Certain very important types like
String
have many methods that are implemented using native code. TheLength
property ofString
is one such example. This can also be seen from theextern
modifier. Reflector cannot show you the implementation of these methods.