what does static void Main(string[] args) in C# mean????????

Answer Posted / subhash

This can be explained as below

public : since the method will be accessed by the other
classes(.net runtime). That is why access modifier is Public

Static:
.net runtime environment call static method of the class
where main is defined. By making Main method as static .net
runtime environment do not need to make object of the class.
runtime environment call the method something like as stated
below.

Class A
{
A()
{}
public static void Main(string[] agrs)
{
}
}

.net Runtime-->
A.Main(args)

Void :
Main method does not return anything

(string[] args):
Here we can pass any number of parameter to the class.
lets say we are making an exe taking 2 parameters then we
can pass parameters to the main method

Is This Answer Correct ?    89 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the implicit name of the parameter that gets passed into the set method/property of a class?

703


Explain the difference between class and interface in .net?

643


Why var is used in c#?

713


Explain the difference between private and shared assembly?

667


How are Windows programs different from normal C-programs?

1902


Define satellite assembly in c#?

653


Why do we use void in c#?

657


What is a partial method?

695


Explain use of abstract and sealed classes in c#?

633


What you mean by delegate in c#?

668


Explain deadlock?

673


How do I join one form to another in c#?

667


Is c# queue thread safe?

691


Is an interface a type c#?

718


What is response redirect in c#?

665