How do you declare a method in c#?



How do you declare a method in c#?..

Answer / Vikash Trivedi

You can declare a method in C# using the following syntax: returnType MethodName(parameters) { ... }. For example, void HelloWorld() { Console.WriteLine("Hello World!"); }

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Sharp Interview Questions

Describe ado.net?

1 Answers  


Why we use anonymous methods in c#?

1 Answers  


What is the syntax for calling an overloaded constructor within a constructor?

1 Answers  


What is the difference between protected and private?

1 Answers  


what are the files we need to deploay a project in the system?

2 Answers  


What is the difference between field and variable in c#?

1 Answers  


What are managed providers?

1 Answers   UGC Corporation,


I created a class which is inherited from interface IDisposable. Now if I use object of this class with using keyword. Then How the dispose method will get call. Does garbage collector call it or some else.

2 Answers   Sapient,


What is wrong with the sample program below?

1 Answers  


what is the meaning of Object lifetime in OOPS

1 Answers   HCL,


Why do we need a singleton class?

1 Answers  


How to force my .net app to run as administrator on windows 7?

1 Answers  


Categories