VB.Net Tutorial/Class Module/Named Parameters

Материал из VB Эксперт
Перейти к: навигация, поиск

Use named parameters

Option Strict On
Public Class Person
   Private firstName As String
   Private middleName As String
   Private lastName As String
   Public Sub New(firstName As String, middleName As String , lastName As String)
      Me.firstName = firstName
      Me.middleName = middleName
      me.lastName = lastName
   End Sub
End Class
Public Module CallingFunctions
   Public Sub Main()
      Dim person2 As New Person("John", "J.", "Smith")
      Dim person1 As New Person(firstName := "John", lastName := "Smith", middleName := "J.")
   End Sub
End Module