Dictionary is not like a array
As the title, everybody knows that, a dictionary is not a array, and not a arraylist, neither two array or two arraylist.
Then there is a problem:
I use this to iterate the array(arr_tmp):
for(int i = 0; i < arr.length; i++){ sum += arr[i]; }
I use this to iterate the arraylist(arrlst_tmp):
for(int i = 0; i < arrlst_tmp.count; i++){ sum += arrlst_tmp[i]; }
and I use the same thing to iterate the dictionary(dic_tmp):
for(int i = 0; i < dic_tmp.count; i++){ sum += dic_tmp.ElementAt(i).Value; }
But one day I read some thing from another one, it tells about the run time and the efficiency of the iterate takes, then he recommended this:
foreach (KeyValuePair<int, int> pair in dic_tmp) { sum += pair.Value; }
TKS that you tell me I'm foolish, and it will take time and will take long time for me to be a programmer.