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
Are c# references the same as c++ references?
What are access modifiers in c#?
What is a view? What is the use of it?
Differentiate between method overriding from method overloading with its functionality?
What is difference between ienumerable and iqueryable in c#?
Explain the differences between static, void and public in c#?
why delegate is type safe?
What are the Types of caching
How does foreach loop work in c#?
What is routing in c#?
What is the use of return in c#?
Does a class need a constructor c#?
What does static mean in c sharp?
Does c# support a variable number of arguments?
Write a program in C# for checking a given number is PRIME or not.