Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class FedExShipmentCollection
- Inherits CollectionBase
- Default Property Item(ByVal Index As Integer) As FedExShipment
- Get
- Return CType(List.Item(Index), FedExShipment)
- End Get
- Set(ByVal Value As FedExShipment)
- List.Item(Index) = Value
- End Set
- End Property
- Function Add(ByVal Item As FedExShipment) As Integer
- Return List.Add(Item)
- End Function
- End Class
- Class FedExShipmentLineItem
- Implements System.IEquatable(Of FedExShipmentLineItem)
- Private _itemDescription As System.String
- Private _countryOfOrigin As System.String
- Private _FedExShipment As FedExShipment
- Public Shadows Function Equals(ByVal other As FedExShipmentLineItem) As Boolean Implements IEquatable(Of FedExShipmentLineItem).Equals
- If other Is Nothing Then Return False
- If Me Is other Then Return True
- Return Me.ItemDescription.Equals(other.ItemDescription) AndAlso Me.CountryOfOriginCode.Equals(other.CountryOfOriginCode)
- End Function
- Public Overrides Function GetHashCode() As Integer
- Dim hashItemDescription As Integer = If(ItemDescription Is Nothing, 0, ItemDescription.GetHashCode)
- Dim hashCountyOfOrigin As Integer = If(CountryOfOriginCode Is Nothing, 0, CountryOfOriginCode.GetHashCode)
- Return hashCountyOfOrigin Xor hashItemDescription
- End Function
- Public Sub New(ByRef FedExShipment As FedExShipment)
- _FedExShipment = FedExShipment
- FedExShipment.AddLineItem(Me)
- End Sub
- Public Property ItemDescription As System.String
- Get
- Return _itemDescription
- End Get
- Set(ByVal Value As System.String)
- _itemDescription = Value
- End Set
- End Property
- Public Property CountryOfOriginCode As System.String
- Get
- Return _countryOfOrigin
- End Get
- Set(ByVal Value As System.String)
- 'If Value.Length <> 2 Then Throw New ArgumentException("CountryOfOriginCode must be 2 characters.")
- _countryOfOrigin = Value
- End Set
- End Property
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement