Hello!
i have this dictionary variable : new Dictionary(of String, String) From {{“A”,10},{“B”,20}, {“C”, “30”},{“D”,40}}
is it possible to add the all the key value?if so how do i do it?
example : 10+20+30+40 = 100
thank you in advance!
Hello!
i have this dictionary variable : new Dictionary(of String, String) From {{“A”,10},{“B”,20}, {“C”, “30”},{“D”,40}}
is it possible to add the all the key value?if so how do i do it?
example : 10+20+30+40 = 100
thank you in advance!
Try this blow expression
newValue = Cdbl(yourDictionaryVariable(“key”).Tostring) + Cdbl(yourDictionaryVariable(“key”).Tostring)
Regards
Gokul
Hi @ramadhani.sheffi ,
For a more dynamic approach to Sum up all of the Values of the Dictionary (Provided all values are numbers), we can use the below Expression :
myDict = new Dictionary(of String, String) From {{"A","10"},{"B","20"}, {"C", "30"},{"D","40"}}
TotalSum = myDict.Values.Sum(Function(x)CDbl(x))
Where TotalSum
is of the data Type Double
, myDict
is of Data Type Dictionary(Of String,String)
It works! Thank you very much for the answer!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.