I just saw this line of C# code and I am wondering if it is expensive
Assembly assembly = useEntryAssembly ? Assembly.GetEntryAssembly() : Assembly.GetCallingAssembly();
Unless you perform calls like that a lot, the expensiveness is rather minuscule and I wouldn't worry about it.
On my machine Assembly.GetEntryAssembly()
takes 164 ticks the first time and 7 the next on a random run in debug mode. Without diving too deep in with Reflector it seems to be caching the calls.
There are 2597734 ticks a second on my machine, so 164 vs 7 is still unimportant.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With