SEARCH C# PROGRAMMING CODES HERE

Creating Functions

Creating Functions in C#
A function allows you to encapsulate a piece of code and call it from other parts of your code. You may very soon run into a situation where you will need to repeat a piece of code again an again, from multiple places, and this is where functions come in. we can declare functions like as below.
Program

using System;

    namespace Function
    {
        public class Program
        {
            /*Creating User Defined function */
            public void Name() /*Function Name*/
            {
                Console.WriteLine("Rohit");
                /*Display the statement*/  
            }

            /* Main function */
            static void Main(string[] args)
            {
                Program Display = new Program(); /* Creating Object */
                Display.Name(); /* Calling Function */        
                Console.ReadKey();
          
                }           
            }
      }

     Output-Rohit