C# FunctionFunction is a block of code that has a signature. Function is used to execute statements specified in the code block. A function consists of the following components: Function name: It is a unique name that is used to make Function call. Return type: It is used to specify the data type of function return value. Body: It is a block that contains executable statements. Access specifier: It is used to specify function accessibility in the application. Parameters: It is a list of arguments that we can pass to the function during call. C# Function SyntaxAccess-specifier, parameters and return statement are optional. Let's see an example in which we have created a function that returns a string value and takes a string parameter. C# Function: using no parameter and return typeA function that does not return any value specifies void type as a return type. In the following example, a function is created without return type. Output: This is non parameterized function C# Function: using parameter but no return typeOutput: Hello Rahul Kumar A function can have zero or any number of parameters to get data. In the following example, a function is created without parameters. A function without parameter is also known as non-parameterized function. C# Function: using parameter and return typeOutput: Inside Show Function Hello Rahul Kumar Next TopicCall By Value |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India