I l @ ve RuBoard |
Another way to define variables is through the use of formal method parameters. Table C.1 outlines the four types of method parameters. Table C.1. Parameter Types in VB.NET
Consider the following class that employs each of the parameter types: Imports System Class Test Sub ValueParamMethod(a As Integer) a = a + 2 ' the orginal parameter is not modified End Sub Sub RefParamMethod(ByRef a As Integer) a = a + 2 ' the orginal parameter is not modified End Sub Sub OptionalParamMethod(Optional a As Integer = 3) a = a + 2 ' if a is not supplied, defaults to 3 End Sub Sub ParamArrayMethod(ParamArray args As Integer) ' provides flexibility through indefinite number of arguments End Sub End Class |
I l @ ve RuBoard |