方法名称是否已编译到EXE中? [英] Do method names get compiled into the EXE?

查看:71
本文介绍了方法名称是否已编译到EXE中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Windows App项目编译为EXE之后,类,方法和变量名称是否包含在MSIL中?

Do class, method and variable names get included in the MSIL after compiling a Windows App project into an EXE?

  • 对于混淆-名称较少,更难进行反向工程.
  • 为了获得性能-较短的名称,更快的访问权限.
  • For obfuscation - less names, harder to reverse engineer.
  • And for performance - shorter names, faster access.

例如因此,如果通过名称调用方法:

e.g. So if methods ARE called via name:

  • 保留名称 short ,为命名查找提供更好的性能.
  • 保留名称神秘,更难反编译.
  • Keep names short, better performance for named-lookup.
  • Keep names cryptic, harder to decompile.

推荐答案

是的,它们在IL中-启动反射器,您会看到它们.如果它们没有出现在IL中,那么您就无法将它们构建为库. (是的,您可以引用.exe文件,就像它们是类库一样.)

Yes, they're in the IL - fire up Reflector and you'll see them. If they didn't end up in the IL, you couldn't build against them as libraries. (And yes, you can reference .exe files as if they were class libraries.)

但是,所有这些都在JIT中解决了一次.

However, this is all resolved once in JIT.

保持名称可读,以便将来可以维护代码.性能问题不太可能造成任何可衡量的差异,并且如果您想混淆代码,请不要在源代码级别(因为您在 一个人来阅读代码)-用专用的混淆器来完成.

Keep names readable so that you'll be able to maintain the code in the future. The performance issue is unlikely to make any measurable difference, and if you want to obfuscate your code, don't do it at the source code level (where you're the one to read the code) - do it with a purpose-built obfuscator.

至于其中包含的内容-为什么不只启动Reflector或ildasm并找出来?从内存中,您会丢失局部变量名(如果生成的话,这些变量名会在pdb文件中),但仅此而已.私有方法名称和私有变量名称仍然存在.

As for what's included - why not just launch Reflector or ildasm and find out? From memory, you lose local variable names (which are in the pdb file if you build it) but that's about it. Private method names and private variable names are still there.

这篇关于方法名称是否已编译到EXE中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆