回答編集履歴
2
ソース修正
test
CHANGED
@@ -20,14 +20,14 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
Dim dic As New Dictionary(Of
|
23
|
+
Dim dic As New Dictionary(Of String, TestData)
|
24
24
|
|
25
|
-
For i = 0 To 10
|
25
|
+
For i = 0 To 10
|
26
26
|
|
27
|
-
dic.Add(i, New TestData With {.Index = i, .Qty = i * 10})
|
27
|
+
dic.Add($"{i:0000}", New TestData With {.Index = i, .Qty = i * 10})
|
28
28
|
|
29
|
-
Next
|
29
|
+
Next
|
30
30
|
|
31
|
-
dic(1).Qty += 10000
|
31
|
+
dic("0001").Qty += 10000
|
32
32
|
|
33
33
|
```
|
1
追記
test
CHANGED
@@ -1,3 +1,33 @@
|
|
1
1
|
4項目目(1~3行目が”0001”の箇所)、5項目目(3,4行目が”0002”の箇所)、9項目目("101"の箇所)
|
2
2
|
|
3
3
|
これが文字列で桁数が決まっているのであれば、連結してDictionaryのキーにすればどうですか?
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
追記
|
8
|
+
|
9
|
+
例
|
10
|
+
|
11
|
+
```VBNET
|
12
|
+
|
13
|
+
Class TestData
|
14
|
+
|
15
|
+
Public Property Index As Integer
|
16
|
+
|
17
|
+
Public Property Qty As Integer
|
18
|
+
|
19
|
+
End Class
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
Dim dic As New Dictionary(Of Integer, TestData)
|
24
|
+
|
25
|
+
For i = 0 To 10
|
26
|
+
|
27
|
+
dic.Add(i, New TestData With {.Index = i, .Qty = i * 10})
|
28
|
+
|
29
|
+
Next
|
30
|
+
|
31
|
+
dic(1).Qty += 10000
|
32
|
+
|
33
|
+
```
|