TOP CATEGORIES

×

What is the USER defined function in C#?

C

Coding King

In C# programming there are two types of functions i.e. system-defining and user-defining, before understanding a user-defined function you need to know what a function is actually.

A function is a code of block either predefined by the system in the class library or written by the user to perform some specific task.  In simple words, a group of code combined to perform a desired action or generate some output is called a function.

User Defined Function

A function written by the user to perform a specific action or generate some results is called a user-defined function. Here is an example of a user-defined function.

static void Sum()

        {

            int x = 50;

            int y = 23;

            int sum = x + y;

            Console.WriteLine($"Sum of {x} and {y} is {sum}");

        }

0 votes

Your Answer

Email: advertise@gdatamart.com

Donate: To Support US

© 2024 GDATAMART.COM (All Rights Reserved)