X-Received: by 10.182.236.225 with SMTP id ux1mr8897041obc.2.1447262046520; Wed, 11 Nov 2015 09:14:06 -0800 (PST) X-Received: by 10.50.97.38 with SMTP id dx6mr57811igb.9.1447262046498; Wed, 11 Nov 2015 09:14:06 -0800 (PST) Path: csiph.com!xmission!news.glorb.com!i2no1898645igv.0!news-out.google.com!f6ni1247igq.0!nntp.google.com!i2no392337igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: it.comp.lang.visual-basic Date: Wed, 11 Nov 2015 09:14:06 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=93.47.252.200; posting-account=4c3DWgoAAADQcJJevo-GlQ6CVmV90H2x NNTP-Posting-Host: 93.47.252.200 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Comportamento HashSet(Of T).Add() From: Antologiko Injection-Date: Wed, 11 Nov 2015 17:14:06 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: csiph.com it.comp.lang.visual-basic:18561 Buonasera a tutti. Ho la seguente struttura dati Private Structure Link Dim ParentID As Long Dim ChildID As Long Friend Sub New(ParentID As Long, ChildID As Long) Me.ParentID =3D ParentID Me.ChildID =3D ChildID End Sub End Structure Adesso definisco le variabili Dim Links As HashSet(Of Link) =3D New HashSet(Of Link) Dim P As Long =3D ... un valore qualsiasi Dim C As Long =3D ... un valore qualsiasi Dim L1 As Link =3D New Link(P, C) Dim L2 As Link =3D New Link(P, C) Dim B As Boolean Dopodich=E9 aggiungo i due link all'insieme B =3D Links.Add(L1) B =3D Links.Add(L2) Nota: il metodo Add restituisce True solo se l'oggetto viene aggiunto all'insieme, e questo accade solo se esso non =E8 gi=E0 presente nell'insieme. La domanda =E8: posso stare sicuro che per qualsiasi valore dato a P e C, il secondo Add() restituir=E0 False? Od in altre parole, come viene calcolato l'hashcode per le strutture come Link?