Chapter 17 Working with VB .NET


Method

You design a VB .NET method using an operation. Methods can be functions or subs.

You design a function using an operation with a return value.

You design a sub using an operation with an empty return type.

The following table summarizes the different methods supported in PowerDesigner:

VB .NET method PowerDesigner equivalent
Shadowing or Overloads method Select Shadows or Overloads from the Shadowing list on the VB.NET tab of the operation property sheet
Shared method Select the Static check box on the General tab of the operation property sheet
NotOverridable method Select the Final check box on the General tab of the operation property sheet
Overridable method Select the Overridable check box on the VB.NET tab of the operation property sheet
MustOverride method Select the Abstract check box on the General tab of the operation property sheet
Overrides method Select the Overrides check box on the VB.NET tab of the operation property sheet

Shadowing

To define a shadowing by name, select Shadows from the Shadowing list on the VB.NET tab of the operation property sheet . To define a shadowing by name and signature select Overloads. In the following example, class Derived inherits from class Base:


Operation F in class Derived overloads operation F in class Base; and operation G in class Derived shadows operation G in class Base:

Public Class Derived
   Inherits Base
      Public Overloads Sub F(ByVal i As Integer)
      End Sub
      Public Shadows Sub G(ByVal i As Integer)
      End Sub
End Class

Method parameters

You define VB .NET method parameters using operation parameters.

You can define the following parameter modifiers in PowerDesigner:

VB .NET modifier PowerDesigner equivalent
ByVal Select In in the Parameter Type box on the parameter property sheet General tab
ByRef Select In/Out or Out in the Parameter Type box on the parameter property sheet General tab
Optional Set the Optional extended attribute on the Extended Attributes tab to True
ParamArray Select the Variable Argument checkbox on the parameter property sheet General tab

Method implementation

Class methods are implemented by the corresponding interface operations. To define the implementation of the methods of a class, you have to use the To be implemented button in the Operations tab of a class property sheet, then click the Implement button for each method to implement. The method is displayed with the <<Implement>> stereotype.

 


Copyright (C) 2006. Sybase Inc. All rights reserved.