Is it possible to to declare a function which returns two parameters using out and also has a third parameter which is recieved? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it possible to to declare a function which returns two parameters using out and also has a third parameter which is recieved?

I was wondering if I have to take a parameter to use in a function but also return two as answers using out.

7th Jan 2017, 3:04 AM
Prashant Brahmbhatt
Prashant Brahmbhatt - avatar
2 Answers
+ 1
The functions in C# can receive any number of parameters and out any number of parameters so it's possible just like this : public bool MyFunction(string receivedPar1,string receivedPar2, out string outPar1, out string outPar2) but you have to assign values for all out parameters before return from the function.
7th Jan 2017, 4:43 AM
Ahmad Hamdan
Ahmad Hamdan - avatar
+ 1
thanks
7th Jan 2017, 4:45 AM
Prashant Brahmbhatt
Prashant Brahmbhatt - avatar