DAC
DAC

Reputation: 1809

Using reflection to determine assembly module type

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.

Upvotes: 1

Views: 365

Answers (1)

ybo
ybo

Reputation: 17162

Not 100% sure about that, but I think that Assembly.EntryPoint is null for DLLs.

Upvotes: 1

Related Questions