- Back to Home »
- C#.NET »
- C#.NET Methods
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.
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
- C#.NET Simple Method
- C#.NET Method with arguments
- C#.NET Method with return type
- C#.NET Method with arguments and return type
- C#.NET Abstract Method
- C#.NET Static Method