You can call a method in C# by specifying its name only. Here is an example:
Calling a Method in C# Example
In the following case, a SomeMethod() will be called from the Main() method and after completing the SomeMethod() the control will return to the Main() method.
using System; namespace CallingAMethod { class CallingAMethod { static void Main() { Console.WriteLine("In Main! Calling SomeMethod( )..."); SomeMethod(); Console.WriteLine("Back in Main( )."); Console.ReadLine(); } static void SomeMethod() { Console.WriteLine("Greetings from SomeMethod!"); } } }
Output
In Main! Calling SomeMethod( )... Greetings from SomeMethod! Back in Main( ).