+2008-05-08 Robert Jordan <robertj@gmx.net>
+
+ * DictionaryEntry.cs: Rename fields for serialization
+ compatibility with MS. Accept null keys on 2.0 profile.
+ Fixes #381922.
+
2008-04-13 Jb Evain <jbevain@novell.com>
* ArrayList.cs, BitArray.cs, CaseInsensitiveComparer.cs
#endif
[Serializable]
public struct DictionaryEntry {
- private object key;
- private object val;
+ private object _key;
+ private object _value;
public DictionaryEntry (object key, object value)
{
+#if ONLY_1_1
if (key == null)
throw new ArgumentNullException ("key");
-
- this.key = key;
- val = value;
+#endif
+ _key = key;
+ _value = value;
}
public object Key {
- get {return key;}
+ get {return _key;}
set {
+#if ONLY_1_1
if (value == null)
throw new ArgumentNullException ("value");
- key = value;
+#endif
+ _key = value;
}
}
+
public object Value {
- get {return val;}
- set {val = value;}
+ get {return _value;}
+ set {_value = value;}
}
}
}
+2008-05-08 Robert Jordan <robertj@gmx.net>
+
+ * DictionaryEntryTest.cs: Add tests for key's argument validation.
+
2008-03-24 Gert Driesen <drieseng@users.sourceforge.net>
* DictionaryBaseTest.cs: Improved existing tests, and use Assert class
d.Value = 'p';
AssertEquals ("#04", d.Value, 'p');
}
+
+ [Test]
+#if ONLY_1_1
+ [ExpectedException (typeof (ArgumentNullException))]
+#endif
+ public void NullKeyCtor ()
+ {
+ DictionaryEntry d = new DictionaryEntry (null, "bar");
+ }
+
+ [Test]
+#if ONLY_1_1
+ [ExpectedException (typeof (ArgumentNullException))]
+#endif
+ public void NullKeySetter ()
+ {
+ DictionaryEntry d = new DictionaryEntry ("foo", "bar");
+ d.Key = null;
+ }
}
}