HI,
I have a requirement to create a C# application with some methods in it and without any main. Can this be possible? Can we use any other entry points than main()?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 7, 2014, 5:31 AM
However, this is in fact an illusion. When the application is built, VS generates the Main method automatically even though you don't see it.
What you might be thinking of here is a class library application or .NET dll. These don't require an entry-point and don't therefore have a Main method. The purpose of this type of application is to provide library classes for other applications to use.
Where an application does require an entry-point (i.e. an exe), then this has to be provided via a Main() method. Other methods cannot be used instead.
Lakshmanan Sethu SankaranarayanPosted Apr 7, 2014, 5:21 AM
Munesh SharmaPosted Apr 7, 2014, 4:49 AM
Abhay ShankerPosted Apr 7, 2014, 4:40 AM
Jignesh TrivediPosted Apr 7, 2014, 4:32 AM
hi,
The Main method is the entry point of a C# console application or windows application. I think it is not possible to C# application without main method. but we may have multiple main methods in different class.
Khan Abrar AhmedPosted Apr 7, 2014, 4:13 AM
You can't, because main() method is the entry point of consol application, form that method progams are executing.