Either
if(hashMap.ContainsKey(index))
{
int val = hashMap[index];
val++;
hashMap[index] = val;
}
or
int val;
if(hashMap.TryGetValue(index, out val))
{
val++;
hashMap[index] = val;
}
Edit: The first version (using the method ContainsKey) has worse performance than the second because you're asking the Dictionary three times to look up the key (instead of two times).
Richards solution above (omitting the if-check) is the most concise one because it makes the else-part obsolete. But it's only safe to use/not ambiguous because the default value of your value type of your Dictionary (in this case 0 for int) can't be a valid entry.