Let's say I have two types in my program, Foo
and Bar
. Both have a static void Main(string[] args)
. To compile this program, a compiler flag /main:class
is needed.
Is it possible to determine at runtime which of the two types contains the entry point, i.e., to get a TypeInfo
or MethodInfo
pointing me to the correct class or the correct Main
method?
UPD: to be more precise, is it possible to do so from a class library linked to the main application (i.e., without prior knowledge of possible options)?
An assembly has a public virtual MethodInfo EntryPoint { get; }
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