Defines the parameter to which it applies as an out parameter. An out
parameter is a variation on a parameter passed by reference using the
keyword. In the case of a parameter passed by reference, the caller
of the method is responsible for allocating memory and passing its
address to the caller, which can then modify the parameter value. In
the case of an out parameter, memory for the parameter is allocated
by the called method and only its value is returned to the caller.
This makes out parameters rather than reference parameters far more
efficient in remoting (i.e., calls across machines) and in web method
Although you can define an out parameter using the
<Out> attribute, the VB.NET compiler does
not enforce it. That is, if you fail to assign a value to the out
parameter, or if you indicate that the parameter is to be passed by
value rather than by reference, the compiler does not generate an
error. Because of this, be especially careful to make sure that all
parameters marked with the
are passed using the
ByRef keyword, and that
you’ve explicitly assigned a value to the out
parameter in the method.
Imports System Imports System.Runtime.InteropServices Public Class CPerson Private iAge, iHeight, iWeight As Integer Private sName As String Public Sub New(strName As String) 'Here we'd ordinarily perform a database ...