Defining New Data Types
His parents give him love and affection...
To keep him strong... moving in the right direction.
- Stevie Wonder
The Type Definition statement defines a new data type as an alias to an existing type. It can be a primitive data type, a method reference or a class. If 'Type' is a primitive data type, the ‘ref’ keyword can also be used to define a data type which is a primitive reference. The ‘type’ statement is particularly useful for method references, since the funky method reference syntax only needs to be entered once, and then the method reference data type (sometimes referred to as a “Handler” data type when used with events) can be used instead.
The following table shows the syntax for the 'type' statement.
The following keywords are supported by the 'type' statement.
The new TypeName can be used anywhere a valid data type is required, as long as the visibility keywords are set accordingly. As mentioned above, this statement is particularly useful for method references, since the tricky syntax is entered only once, and then the alias name is used everywhere else.
♦ When a method reference is used when defining an array or as an argument to a method, this alias name should be used rather than the original method reference sytnax.