Imports System.Collections.Generic
Dim bollettino1 As New BollettinoMeteo("Roma") With { .Temperatura = 9.7, .Pressione = 0.99}
Dim bollettino2 As New BollettinoMeteo("Milano") With { .Temperatura = 11.2, .Pressione = 1.01 }
Dim bollettino3 As New BollettinoMeteo("Roma") With { .Temperatura = 12.5, .Pressione = 1.00 }
Dim lista As new HashSet(Of BollettinoMeteo)
Console.WriteLine("La lista contiene {0} elementi", lista.Count)
Public Class BollettinoMeteo
Public Sub New(città as String)
Public ReadOnly Property Città As String
Public Property Temperatura As Decimal
Public Property Pressione As Decimal
Public Overrides Overloads Function Equals(obj As Object) As Boolean
If obj Is Nothing OrElse Not Me.GetType() Is obj.GetType() Then
Dim altroBollettino = CType(obj, BollettinoMeteo)
Return Me.Città = altroBollettino.Città
Public Overrides Function GetHashCode() As Integer
Return If(Città, "").GetHashCode()