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