Changeset 312 for trunk/Include/Classes/System/Collections
- Timestamp:
- Aug 27, 2007, 12:38:43 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/Collections/Generic/Dictionary.ab
r311 r312 8 8 9 9 Namespace Detail 10 Class Pair 10 Class Pair<TKey, T> 11 11 Public 12 Sub Pair(key As Object, value As Object)12 Sub Pair(key As TKey, value As T) 13 13 Key = key 14 14 Value = value 15 15 End Sub 16 16 17 Key As Object18 Value As Object17 Key As TKey 18 Value As T 19 19 End Class 20 20 End Namespace 'Detail … … 39 39 ' End Function 40 40 41 ' Virtual Function Item(key As Key) As T 42 Virtual Function Item(key As Key) As Object 41 Virtual Function Item(key As Key) As T 43 42 Imports System.Collections.Generic.Detail 44 43 … … 54 53 Dim i As Long 55 54 For i = 0 To ELM(a.Count) 56 Dim pair = a[i] As Pair 55 Dim pair = a[i] As Pair<T, Key> 57 56 If pair.Key.Equals(key) Then 58 57 Return pair.Value … … 82 81 Dim i As Long 83 82 For i = 0 To ELM(a.Count) 84 Dim pair = a[i] As Pair 83 Dim pair = a[i] As Pair<T, Key> 85 84 If pair.Key.Equals(key) Then 86 85 pair.Value = value … … 89 88 End If 90 89 91 a.Add(New Pair (key, value))90 a.Add(New Pair<T, Key>(key, value)) 92 91 End Sub 93 92 … … 96 95 /* 97 96 'Operators 98 ' Function Operator [](key As Key) As T 99 Function Operator [](key As Key) As Object 97 Function Operator [](key As Key) As T 100 98 Return Item[key] 101 99 End Function … … 123 121 Dim i As Long 124 122 For i = 0 To ELM(a.Count) 125 Dim pair = a[i] As Pair 123 Dim pair = a[i] As Pair<T, Key> 126 124 If pair.Key.Equals(key) Then 127 125 'Throw ArgumentError … … 130 128 End If 131 129 132 a.Add(New Pair (key, value))130 a.Add(New Pair<T, Key>(key, value)) 133 131 End Sub 134 132
Note:
See TracChangeset
for help on using the changeset viewer.