DLL with main entry point

M

Mythran

Hmm, just for my test applications, I want to create a dll that has a class:

public class MyTest
{
[STAThread()]
public void Main(string[] Args)
{
... blah ...
}
}

I want to inherit this class in a Console application, and not have a main
entry point defined. Obviously, this goes against having an application (no
entry point), but still, theoretically, it does have an entry point defined
in the base class...so...theoretically..still..shouldn't it work?

Thanks,
Mythran
 
C

Chris Dunaway

How does it know that your class contains the entry point? Most of the
time, Main is declared as static. Perhaps that will work.
 
L

Lebesgue

Static methods are not inherited. You also should not define entry point in
a dll. What do you want to achieve?
 
G

Guest

in the base class...so...theoretically..still..shouldn't it work?

No, but you can do it the other way... instead of a DLL, make it an EXE. You
can still reference the assembly from other assemblies.

A use of this could be that when executed the code can display information
about itself.
 
M

Mythran

Lebesgue said:
Static methods are not inherited. You also should not define entry point
in a dll. What do you want to achieve?

For testing, I have a solution with 3 projects...a C# DLL, C# Console, and
VB Console. I have a base class in the C# dll that both console apps' class
derive from. I see that static methods aren't inherited so theoretically,
my theoretics are messed up :)

Thanks,
Mythran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top