- Back to Home »
- C#.NET »
- C#.NET Method with Return Type
Posted by :
Sudhir Chekuri
Thursday, 31 December 2015
It is one of the method that doesn't have any arguments/parameters. It contains only return type.
Example
public int add()
{
Console.WriteLine("addition");
return 1;
}
A method can return value to anything which is capable of holding that value.
Example
int i=add();
Console.WriteLine(i);//1
Explanation
In the above example the add method can return value'1' to i and it will be printed as output.
Example
public int add()
{
Console.WriteLine("addition");
return 1;
}
A method can return value to anything which is capable of holding that value.
Example
int i=add();
Console.WriteLine(i);//1
Explanation
In the above example the add method can return value'1' to i and it will be printed as output.