-
Notifications
You must be signed in to change notification settings - Fork 3
/
Person.vb
99 lines (74 loc) · 2.46 KB
/
Person.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
Imports System
Namespace DragAndDropRows
Public Class Person
Private firstNameField As String
Private lastNameField As String
Private countryField As String
Public Sub New()
End Sub
Public Sub New(ByVal firstName As String, ByVal lastName As String, ByVal country As String)
firstNameField = firstName
lastNameField = lastName
countryField = country
End Sub
Public Property FirstName As String
Get
Return firstNameField
End Get
Set(ByVal value As String)
firstNameField = value
End Set
End Property
Public Property LastName As String
Get
Return lastNameField
End Get
Set(ByVal value As String)
lastNameField = value
End Set
End Property
Public Property Country As String
Get
Return countryField
End Get
Set(ByVal value As String)
countryField = value
End Set
End Property
End Class
Public Class PersonEx
Inherits Person
Private idField As Integer
Private parentIDField As Integer
Private Shared counter As Integer = 1
Public Sub New()
End Sub
Public Sub New(ByVal firstName As String, ByVal lastName As String, ByVal country As String, ByVal parentID As Integer)
MyBase.New(firstName, lastName, country)
parentIDField = parentID
idField = Math.Min(Threading.Interlocked.Increment(counter), counter - 1)
End Sub
Public Sub New(ByVal person As Person, ByVal parentID As Integer)
Me.New(person.FirstName, person.LastName, person.Country, parentID)
End Sub
Public Property ID As Integer
Get
Return idField
End Get
Set(ByVal value As Integer)
idField = value
End Set
End Property
Public Property ParentID As Integer
Get
Return parentIDField
End Get
Set(ByVal value As Integer)
parentIDField = value
End Set
End Property
Public Function ToArray() As Object()
Return New Object() {ID, ParentID, FirstName, LastName, Country}
End Function
End Class
End Namespace