[Mono-list] patch: ctr and GetObjectData for NameObjectCollectionBase
Cesar Octavio López Nataren
cesar@ciencias.unam.mx
Thu, 15 Aug 2002 15:08:02 -0500
This is a MIME-formatted message. If you see this text it means that your
mail software cannot handle MIME-formatted messages.
--=_0_29639_1029442082
Content-Type: text/plain; format=flowed; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Best regards mono:: team.
cesar
--=_0_29639_1029442082
Content-Disposition: attachment; filename="NameObjectCollectionBaseChangeLogEntry.diff"
Content-Type: text/plain; charset="iso-8859-1"; name="NameObjectCollectionBaseChangeLogEntry.diff"
Content-Transfer-Encoding: 7bit
Index: NameObjectCollectionBase.cs
===================================================================
RCS file: /mono/mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs,v
retrieving revision 1.7
diff -u -r1.7 NameObjectCollectionBase.cs
--- NameObjectCollectionBase.cs 23 Jul 2002 03:47:46 -0000 1.7
+++ NameObjectCollectionBase.cs 15 Aug 2002 19:52:54 -0000
@@ -1,5 +1,5 @@
/**
- * System.Collections.Specialized.NamaValueCollection class implementation
+ * System.Collections.Specialized.NameValueCollection class implementation
*
* Author: Gleb Novodran
*/
@@ -202,8 +202,19 @@
}
protected NameObjectCollectionBase( SerializationInfo info, StreamingContext context )
{
- throw new Exception("Not implemented yet");
+ int i, tmpCount;
+
+ this.IsReadOnly = (bool) info.GetValue ("ReadOnly", typeof (bool));
+ this.m_hashprovider = (IHashCodeProvider) info.GetValue ("HashProvider", typeof (IHashCodeProvider));
+ this.m_comparer = (IComparer) info.GetValue ("Comparer", typeof (IComparer));
+ tmpCount = (int) info.GetValue ("Count", typeof (int));
+ string [] tmpKeys = (string []) info.GetValue ("Keys", typeof (string []));
+ object [] tmpObjs = (object []) info.GetValue ("Values", typeof (object []));
+
+ for (i = 0; i < tmpCount; i++)
+ BaseAdd (tmpKeys [i], tmpObjs [i]);
}
+
protected NameObjectCollectionBase( int capacity, IHashCodeProvider hashProvider, IComparer comparer )
{
m_readonly = false;
@@ -249,9 +260,14 @@
// GetHashCode
// ISerializable
- public virtual void /*ISerializable*/ GetObjectData( SerializationInfo info, StreamingContext context )
+ public virtual void GetObjectData( SerializationInfo info, StreamingContext context )
{
- throw new Exception("Not implemented yet");
+ info.AddValue ("ReadOnly", this.IsReadOnly, typeof (bool));
+ info.AddValue ("HashProvider", this.HashCodeProvider, typeof (IHashCodeProvider));
+ info.AddValue ("Comparer", this.Comparer , typeof (IComparer));
+ info.AddValue ("Count", this.Count, typeof (int));
+ info.AddValue ("Keys", this.BaseGetAllKeys (), typeof (string []));
+ info.AddValue ("Values", this.BaseGetAllValues () , typeof (object []));
}
// ICollection
Index: ChangeLog
===================================================================
RCS file: /mono/mcs/class/System/System.Collections.Specialized/ChangeLog,v
retrieving revision 1.13
diff -u -r1.13 ChangeLog
--- ChangeLog 23 Jul 2002 03:47:46 -0000 1.13
+++ ChangeLog 15 Aug 2002 19:58:07 -0000
@@ -1,3 +1,7 @@
+2002-08-15 Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
+ * NameObjectCollectionBase.cs: implemented the ctr and GetObjectData method
+ needed for ISerializable implementation.
+
2002-07-22 Tim Coleman <tim@timcoleman.com>
* NameObjectCollectionBase.cs: added iterator stubb to
NameObjectCollectionBase.KeysCollection
--=_0_29639_1029442082--