I have a question on what the following statement is actually doing on the right side:
WinnerCounts(WinnerName) = WinnerCounts(WinnerName) + 1
WinnerCounts is user created Dictionary(Sting, Int32)
WinnerName is the first input form in the For Each Activity which will hold the value of TourDeFranceWinners.Values
TourDeFranceWinners is a dictiontionary(Int32, String) filled with{{2006,“Oscar Pereiro”},{2007,“Alberto Contador”}} type of info
So in the first iteration this staement would essentially be:
WinnerCounts(“Oscar Pereiro”) = WinnerCounts(“Oscar Pereiro”) + 1
What I want to know is what is the right side of this doing? Because it is a dictionary where the Key is stated, do dictionaries in VB.net automatically correspond to something like a ‘+ 1’ as going to the Value of the dictionary?
For example if ‘WinnerCounts’ was a Dictonary(String, String), and the statement was:
WinnerCounts(“Oscar Pereiro”) = WinnerCounts(“Oscar Pereiro”) + “Good”
Would ‘Good’ automatically be set as the Value side of this dictionary? Thanks.
Hi
Usually a dictionary variable will be having a collection of key-value pairs in it
Where the left side is key and right side is value here
Key - 2006, 2007
It’s corresponding value is
Value - Oscar Pereiro, Alberto Contador
So if I call the dictionary variable like this
WinnerCounts(“Oscar Pereiro”) = WinnerCounts(“Oscar Pereiro”) + 1
Here WinnerCounts is a variable with (string, int) as (key,value)
So if I call with key of string WinnerCounts(“Oscar Pereiro”) then it will give us a int value as a output
Say for example it has 100 as value for the key Oscar Pereiro in it then