+ 2
I am asking is the C # method return multiple values
C# method multiple retun values
4 Antworten
+ 5
Like sneeze already wrote, methods can only have 1 return value (or void), but you could pass arguments by reference. Another nice way supported in C# is passing by output.
Check the "Passing Arguments" lesson (Methods 5/8) in the C# course for more information.
+ 1
In general a method can only return one value (int, bool, string). However there a few ways to return multiple values. You can make the return type a list having the values in the list. Or use ref parameters.
+ 1
I wrote some code to show that it is possible to return multiple values with one method.
https://code.sololearn.com/cX41bh0Svo48
Please put the language you use in your tags
0
thanks a lot sneeze and Chris I saw you code