Posted by : Sudhir Chekuri Thursday, 31 December 2015

  • Method is a piece of code which is used to perform a particular task.
  • A Method can be either no value returning or value returning.
  • If it was a no value returning we will use void as return type for that method. 
  • If it was a value returning we use a specific type i.e., what type of value that a method returns. 
Syntax for creating a method

Access specifier return type methodname( )
{

}

Access Specifier : It is used to define the accessibility level of a method.

Example for access specifiers are public, private, protected etc.

ReturnType: What type of value return by a method is given as return type.

Method name:
The name of a method to call it.

Example

public void add()

{

//Code Logic

}

There are different types of methods 
  1. C#.NET Simple Method
  2. C#.NET Method with arguments
  3. C#.NET Method with return type
  4. C#.NET Method with arguments and return type 
  5. C#.NET Abstract Method
  6. C#.NET Static Method

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Followers

Total Pageviews

Powered by Blogger.

Blog Archive

- Copyright © 2013 DevStudent - Metrominimalist - Powered by Blogger - Designed by Johanes Djogan -