In this article, we will see how to calculate the area of a circle in C# using method. The area of a circle can be evaluated using the formula: Area of circle = pi * r * r //where r is the radius of circle Example:...
Tag - C# Methods
How to Declare Method in C# Program
Method is the building block of object-oriented programming. Methods are generally the block of codes or statements in a program that gives the user the ability to reuse the same code which ultimately saves the excessive use of...
Overloading in C# with Examples
In overloading, there are multiple methods with different method signatures. Below are some examples that show how we can achieve overloading by varying the number of parameters, the order of parameters, and data types of...
C# Method Examples
In this tutorial, we will learn about the C# method with the help of examples. A C# method is a collection of statements that are grouped together to perform an operation. When you call the Console.WriteLine() method, for...
Return an Array From method in C#
In this example, i’ll show you How to return an array from method in C#. Example 1: C# internal class Program { static string[] GetNames() { string[] lang = { "C#", "C++", "Java", "Python" }; return lang; } static void...
C# Method Examples
In this tutorial you will learn how to create and use method in C# programming. Example 1: Write a program to explain method in C#. Create a static function add() that accept two number from user and returns sum of the number...
Method Declaration in C#
Method is the building block of object-oriented programming. It combines related code together and makes program easier. In C# method declaration, you can declare method by following way: C# <Access Specifier> <Return...
C# Anonymous Methods with Examples
An anonymous method is an inline method and it does not have a name, i.e, it has body only. We can define it using a delegate. Let’s try to understand the Anonymous method with the below example. Let’s first create a...
Methods in C# (with Examples)
A method is a collection of statements that perform some specific task and return result to the caller. A method can perform some specific task without returning anything. Methods allow us to reuse the code without retyping the...