Type long is used in case the subtraction result rolls over the maximum or under the minimum for integers.

```
public class Solution {
public int[] TwoSum(int[] nums, int target) {
Dictionary<long, int> valueIndex = new Dictionary<long, int>();
for (int i = 0; i < nums.Length; i++)
{
long complement = (long)target - nums[i];
if(valueIndex.ContainsKey(complement)) return new[] { valueIndex[complement], i };
else
{
if (!valueIndex.ContainsKey((long)nums[i])) valueIndex.Add((long)nums[i], i);
}
}
return new int[]{ 0, 0 };
}
}
```

```
}
```

}