我有一个问题...如果containsvalue的条件为真,我试图放入一个String字典键值列表:
但是,这不正确:(
这是一个代码:
Private listID As New List(Of String) ' declaration of list
Private dictionaryID As New Dictionary(Of String, Integer) ' declaration of dictionary
'put a keys and values to dictionary
dictionaryID.Add("first", 1)
dictionaryID.Add("second", 2)
dictionaryID.Add("first1", 1)
If dictionaryID.ContainsValue(1) Then ' if value of dictinary is 1
Dim pair As KeyValuePair(Of String, Integer)
listID.Clear()
For Each pair In dictionaryID
listID.Add(pair.Key)
Next
End If
Run Code Online (Sandbox Code Playgroud)
现在,列表必须有两个元素... - >"first"和"first1"
你能帮助我吗?非常感谢你!
我有个问题.
我需要一个Javascript函数,它将变量值增加(增量)4,当变量值为20时,将变量值设置为0并再次将其递增4,依此类推......
我认为我需要循环和if条件,但我不知道如何实现这个...
例
结果必须是:
x = 0; 然后x = 4,x = 8,x = 12,x = 16,x = 20,x = 0,x = 4 ....
谢谢