Total Page Preview:   000000000124

What is function in C-Sharp in English and Hindi




Function in C-Sharp in English:

In C#, a function is a block of code that performs a specific task. It can take input parameters, perform operations on those parameters, and return a value or perform a specific action. Here is an example of a simple function in C#:

In this example, the Add function takes two integer parameters a and b. It adds the two integers together and stores the result in a variable called sum. Finally, it returns the value of sum.
You can call this function from your main code as follows:
In this example, the Add function is called with arguments 3 and 4. The function performs the addition operation and returns the value 7, which is then assigned to the result variable.
Note that the public keyword in the function declaration indicates that the function is accessible from other parts of the code. The static keyword means that the function can be called without creating an instance of the class that contains it. The int keyword before the function name specifies the return type of the function.



Function in C-Sharp in Hindi:

C# mein ek function ek aise code block ko kehte hai jo kisi specific task ko perform karta hai. Ye input parameters ko accept kar sakta hai, unpar operations perform kar sakta hai aur ek value ko return kar sakta hai ya phir koi specific action perform kar sakta hai.

Neeche ek example diya gaya hai jisme ek simple function C# mein dikhaya gaya hai:


Iss example mein, Add function do integer parameters a aur b ko leta hai. Yeh dono integers ko add karke unki sum ko sum naam ke variable mein store karta hai. Final mein, yeh sum ke value ko return karta hai.
Aap iss function ko neeche diye gaye code se call kar sakte hai:
Iss example mein, Add function 3 aur 4 ke arguments ke saath call kiya jaata hai. Function addition operation ko perform karta hai aur 7 ke value ko return karta hai, jo result variable mein assign kiya jaata hai.
Note karein ki public keyword function declaration mein iss baat ko indicate karta hai ki function dusre parts of code se accessible hai. Static keyword yeh specify karta hai ki function ko class ke instance create kiye bina bhi call kiya ja sakta hai. Int keyword function name se pehle function ka return type specify karta hai.





Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn :





Facebook User: