More about Methods

In this section we look at several other topics pertaining to methods in VB.NET:

  • Parameter passing

  • Variable-length parameter lists

  • Method overloading

  • Optional parameters

Parameter Passing

Programming languages have different mechanisms for passing parameters. One mechanism is known as call-by-value. This means that the actual data values are copied and passed to the method being called. These copied values are pushed onto the stack, and the called function obtains independent copies of the values. Any changes made to these values will not be propagated back to the calling program. VB.NET supports this mechanism of parameter passing using the ByVal keyword, but VB.NET also supports call-by-reference parameters.

Some terminology ...

Get Application Development Using Visual Basic® and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.