Jetzt hab ich doch noch eine Kleinigkeit...
Ich wollte prüfen, ob es sich bei dem Key um einen Key vom Typ DBNull handelt,
diesen würde ich dann nicht mitzählen wollen.
Gedacht hatte ich mir das so:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
| TypeCode theKey = default(TypeCode); int maxVal = int.MinValue; foreach (KeyValuePair<TypeCode, int> cur in countDic) { int curVal = cur.Value; if (curVal > maxVal) { if (!(cur.Key is DBNull)) { maxVal = curVal; theKey = cur.Key; } } } |
Nur ist cur.Key nie vom Typ DBNull. Warum?
