0
如何添加另一個值/參數/變量到這個例子?如何在VB.Net中爲此示例添加另一個值?
Dim pricesList As New List(Of KeyValuePair(Of String, String))
pricesList.AddRange({New KeyValuePair(Of String, String)("$5", "1"),
New KeyValuePair(Of String, String)("$3", "2")})
For Each item As KeyValuePair(Of String, String) In pricesList
Console.WriteLine(String.Format("Price: {0}, Value {1}", item.Key, item.Value))
Next item
所以,我得到這樣的
Dim pricesList As New List(Of KeyValuePair(Of String, String))
pricesList.AddRange({New KeyValuePair(Of String, String)("$5", "1","1","1"),
New KeyValuePair(Of String, String)("$3", "2","2","2")})
For Each item As KeyValuePair(Of String, String) In pricesList
Console.WriteLine(String.Format("Price: {0}, Value {1}, Value {1}, Value {1}, Value {1}", item.Key, item.Value))
Next item
我該如何爲此添加一些東西? – Hanselman
如果你的意思是你如何在詞典中添加第三個關鍵字,將From子句改爲From {{「$ 5」,{「1」,「1」,「1」}},{「$ 3」, {「2」,「2」,「2」}},{「$ 1」,{「3」,「3」,「3」}}}'。如果你的意思是你如何在每個字典值中有四個值而不是三個值,只需在數組中添加另一個元素即可。例如,將第一個Dictionary項從'{「$ 5」,{「1」,「1」,「1」}}'更改爲'{「$ 5」,{「1」,「1」,「1」, 「1」}}'等等,並將第四項添加到您的'String.Format'語句中。 – Blackwood
ahh :)我的意思是我怎麼可以在我的腳本中的其他地方添加它... 完整說明...我需要從文本框中獲取值...並將其添加到每個按鈕按..然後在每個循環工作atm我需要回聲他們以後... – Hanselman