Question Returning multiple values from called methods


Dec 18, 2012
Programming Experience
Hello I am trying to figure out how to return multiple vaules form a single called method.

Anyone help would be greatly appreciated.
A method can only return one object. That object might contain multiple values though, e.g. an array, collection, Tuple or just have multiple properties. You can also output multiple objects from a method by using one or more parameters declared ByRef. A method with ByRef parameters may or may not also return a value. For instance, if you had to output two values that were basically equivalent then you'd use two ByRef parameters and no return value. However, if there was some logical order of precedence then you might return one and output the other using a ByRef parameter.
Oops! Forgot I was in C# land and not VB land. VB uses ByRef for any parameter that outputs a value. In C#, you use 'ref' for parameters used for input and output and 'out' for parameters used only for output.
Top Bottom