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