i am new in vb.net..
i have started simple progamming in vb.net
in some places i have seen
Shared Sub Main()
or
Sub Main()
what is this...? what is the meaning of shared here?
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.
Sam HobbsPosted Jul 17, 2010, 4:32 PM
In VB.Net, if Main is in a class then you must use Shared else you don't have to use Shared. Otherwise my explanation in your other thread is relevant here too.
Jaish MathewsPosted Jul 17, 2010, 1:20 PM
C# Static = VB.NET Shared
Both key word meant for single copy for any number of object instance rather than each object has it's own copy.
In console application, one automatic entry point needed as these applications are normally GUI free. More over this entry point won't call explicitly, but initiated automatically. So only once instance of this method needed as no user is going to create an object and call this Main() explicitly.