Can we return two values from a function?
Answer Posted / tarun kumar
yes.
for example:
public int Add(int a,int b,out int c)
{
c=a+1;
return a+b;
}
when we call the Add method we will get the sum of the a
and b and can also use the value of c
like
int d=0;
int e= Add(2,3,d) ;
then the value of e will be 5 and the value of d will be 3.
| Is This Answer Correct ? | 9 Yes | 8 No |
Post New Answer View All Answers
What are "class access modifiers" in C#?
State the top.NET class that everything is derived from?
How many types of constructors are there in c#?
Does console.writeline() stop printing when it reaches a null character within a string?
What is a di class?
Can bool be null c#?
Which debugging tools you can use in the .NET ssSDK?
Explain the difference between a namespace and assembly name in .net?
Write a console application and implement the ternary operator to decide whether the age a user entered after being prompted is allowed to vote or not(given that only citizens between 18 and 120 years only inclusive can vote). Use exception handling for non-numerical input.
Difference between a sub and a function in c#.
What type of data type conversion happens when the compiler encounters the following code?
Why do canadians say zed?
What is a concrete class in c#?
Can we create instance of private class in c#?
What is Garbage Collection in .Net?