Using reflection to determine assembly module type
-
05-09-2019 - |
Question
How would one use .net reflection to determine the type of the executing assembly, by type I mean dll or exe. Currently its possible to do something like:
Assembly.GetExecutingAssembly().CodeBase.ToLower.EndsWith(".exe")
But it seems like something better could exist that does not need to do a string comparison, i.e. comparing the assemblies module name would also fall into this category.
Solution
Not 100% sure about that, but I think that Assembly.EntryPoint
is null for DLLs.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow