Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.visual-basic > #18561
| 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 | <c4445ca2-40fb-4806-b2d4-c7dbf89ea975@googlegroups.com> (permalink) |
| Subject | Comportamento HashSet(Of T).Add() |
| From | Antologiko <antologiko@gmail.com> |
| 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 |
Show key headers only | View raw
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 = ParentID
Me.ChildID = ChildID
End Sub
End Structure
Adesso definisco le variabili
Dim Links As HashSet(Of Link) = New HashSet(Of Link)
Dim P As Long = ... un valore qualsiasi
Dim C As Long = ... un valore qualsiasi
Dim L1 As Link = New Link(P, C)
Dim L2 As Link = New Link(P, C)
Dim B As Boolean
Dopodiché aggiungo i due link all'insieme
B = Links.Add(L1)
B = Links.Add(L2)
Nota: il metodo Add restituisce True solo se l'oggetto
viene aggiunto all'insieme, e questo accade solo se esso
non è già presente nell'insieme.
La domanda è: posso stare sicuro che per qualsiasi valore
dato a P e C, il secondo Add() restituirà False?
Od in altre parole, come viene calcolato l'hashcode per le
strutture come Link?
Back to it.comp.lang.visual-basic | Previous | Next | Find similar
Comportamento HashSet(Of T).Add() Antologiko <antologiko@gmail.com> - 2015-11-11 09:14 -0800
csiph-web