Difference between Assembly.GetExecutingAssembly() and typeof(program).Assembly
问题 What is the difference between Assembly.GetExecutingAssembly() and typeof(program).Assembly ? 回答1: Assuming program is in the executing assembly, they should both return the same value. However, typeof(program).Assembly should have better performance, since Assembly.GetExecutingAssembly() does a stack walk. In a micro benchmark on my machine, the former took about 20ns, while the latter was 30x slower at about 600ns. If you control all the code I think you should always use typeof(program)