Why main method is static in c#?
Answer / Manoj Kumar Sharma
The main method is static because it needs to be called before any non-static member (or object) of a class, and the .NET runtime requires a default instance of the application domain to call the main method. By making it static, we ensure that only one instance exists, which simplifies the execution.
| Is This Answer Correct ? | 0 Yes | 0 No |
Can you have parameters for static constructors?
What is Delegate and what is it used for ?
Can firstordefault return null?
What are immutable types in c#?
Why do I get a security exception when I try to run my c# app?
Is c# a strongly-typed language?
What is difference between a function and a method?
What is the difference between and xml documentation tag?
What is the use of console readkey in c#?
What are the types of threading models ?
Name some string escape sequences in c#.
What is the Use Of Interfaces? For example I have a interface as shown below? Interface IMyInterface { public void MyMethod(); } class MyClass : IMyInterface { public void Mymethod() { Some Code } } class Program { static void Main(string[] args) { MyClass obj = new MyClass(); obj.MyMethod(); } } Here What is My Question is? If i remove Interface and run this code, it will executed then what is the Use of the interface? Can any one give me the solution for this Problem? Thanks in Advance!
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)