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 is the use of getcommandlineargs() method in c#.net?
What is the difference between func and action delegate?
Differentiate between the public and private ?
What is the difference between an implicit conversion and an explicit conversion?
What is the use of base keyword? Tell me a practical example for base keyword’s usage?
How do I run managed code in a process?
Does unity require coding?
What is gui in c#?
How do I do implement a assert?
Can a constructor have a return type?
What is a Command Object in C#?
Can we overload indexer in c#?
What is c# entity framework?
What is the default scope of a class in c#?
Explain about finalize method?