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 is required /main:class
.
Is it possible at runtime to determine which of the two types contains an entry point, i.e. to get TypeInfo
or MethodInfo
by pointing me to the correct class or the correct method Main
?
UPD: more precisely, is it possible to do this from the class library associated with the main application (i.e. without prior knowledge of the possible options)?
source
share