Parameters
Another way to define variables is through the use of formal method parameters. Table C.1 outlines the four types of method parameters.
Parameter Type | Modifier | Description |
---|---|---|
value | ByVal | Modifications do not impact original argument passed into the method |
reference | ByRef | Modifications directly impact original argument passed into the method |
optional | Optional | Does not require the argument to be supplied; however, a default value must be supplied in the argument declaration |
parameter array | ParamArray | Enables variable length parameter lists |
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 ...
Get ASP.NET by Example 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.