use of method in c#

 

For Example:  Write a program to demonstrate the use of method.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 

namespace ConsoleApplication13

{

class Program

 { 

 public void display() // method declaration

{

Console.WriteLine("This is example of method");  

}

static void Main(string[] args)

{

 Program p = new Program();   // Here p is object

 p.display();  // Calling Method 

 Console.ReadLine();

     }

    }

  }

Output:

Comments

Popular posts from this blog

queue in C# Programming

collection classes in C#