The functions in C# are known as methods. The C# contains bunch of predefined methods, which you can use throughout your coding process based on your requirements. We have already seen one of the C# predefined methods example in C# Console ReadLine and C# Console WriteLine tutorials. Both methods are predefined in C# and available in Console class. You can also create your own custom methods. The C# custom methods example is given below.
static void Main(string args)
public static void PrintMessage()
Press any key to continue . . .
In the above given example, we have created a C# custom method named PrintMessage. Because the method is static, we can call it directly without creating a C# class instance. This C# custom method does not take any parameter, so we don’t need to pass anything and we can call it directly from the C# Main method.