I have created a minimal example reproducing the problem (or rather my misunderstanding):
string text = @"eaisjdoaisjdoaisjdai_osjdaisodjasizzi_ojiozaziasjz_";
int[] score = new int[123];
foreach(char letter in text)
{
int val = score[letter]; //give me the value stored at the index
score[letter] = val++; //increment it and store it back into the array at the index
}
...
Debugging through the above, val is correctly being assigned the value at the specified index of the array. But when incremented, val is not assigned back into the array. Why is that?
The picture shows the immediate window evaluating the value of val when retrieving it from the array, the value of score[letter] after being assigned to and also the incremented value of val
I'm clearly doing something stupid but can't quite figure out what.

forloop, it looks like you are indexing into your array by the character. Are you sure you want that?valis not being used inside the loop, you can simply writescore[letter]++orscore[letter] += 1to increment the value. Creating the variablevalwithout using it is a bit confusing here.