Protected Function ammountChanges(order As BasicSimpleOrder, createOrDelete As Boolean) As (change As Decimal, currency As String)
End Function
I sort of know that it's possible and I want to learn more about it.
However, if I search in google for
function returning multiple values vb.net
for example,
or in stackoverflow
no body is mentioning that technique.
Even if I search for
function returning multiple values through anonymous type
people are still using different techniques.
Now I think it's a new feature.
Basically, you "can't" really return multiple values. You can return a class or a struct and that class or struct can contain multiple values.
However, recent vb.net improvement allow a convenient way to allow an anonymous type as return values.
However, I cannot find any reference to that method anywhere on the net. Not easily. Not with the keyword I found.
So where is it, and what should I search in google to learn more about this feature.
It's Tuples introduced in Visual Basic 15 / Visual Studio 2017.
See the section: Tuples as method return values where it mentions (with code examples):
A method can return only a single value. Frequently, though, you'd like a method call to return multiple values. There are several ways to work around this limitation:
You can create a custom class or structure whose properties or fields represent values returned by the method. This is a heavyweight solution; it requires that you define a custom type whose only purpose is to retrieve values from a method call.
You can return a single value from the method, and return the remaining values by passing them by reference to the method. This involves the overhead of instantiating a variable and risks inadvertently overwriting the value of the variable that you pass by reference.
You can use a tuple, which provides a lightweight solution to retrieving multiple return values.