Author: gonzalo
Date: 2005-03-14 20:40:13 -0500 (Mon, 14 Mar 2005)
New Revision: 41816

Modified:
   
branches/mono-1-0/mcs/class/System.DirectoryServices/System.DirectoryServices/ChangeLog
   
branches/mono-1-0/mcs/class/System.DirectoryServices/System.DirectoryServices/PropertyValueCollection.cs
Log:
2005-03-14 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * PropertyValueCollection.cs: the Value property for an empty collection
        is now null and setting Value to null clears the collection. Patch by
        Boris Kirzner (Mainsoft).


Modified: 
branches/mono-1-0/mcs/class/System.DirectoryServices/System.DirectoryServices/ChangeLog
===================================================================
--- 
branches/mono-1-0/mcs/class/System.DirectoryServices/System.DirectoryServices/ChangeLog
     2005-03-15 01:39:19 UTC (rev 41815)
+++ 
branches/mono-1-0/mcs/class/System.DirectoryServices/System.DirectoryServices/ChangeLog
     2005-03-15 01:40:13 UTC (rev 41816)
@@ -1,3 +1,9 @@
+2005-03-14 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * PropertyValueCollection.cs: the Value property for an empty collection
+       is now null and setting Value to null clears the collection. Patch by
+       Boris Kirzner (Mainsoft).
+
 2004-06-15  Gert Driesen <[EMAIL PROTECTED]>
 
        * DirectoryServicesPermission.cs: renamed field to match MS.NET

Modified: 
branches/mono-1-0/mcs/class/System.DirectoryServices/System.DirectoryServices/PropertyValueCollection.cs
===================================================================
--- 
branches/mono-1-0/mcs/class/System.DirectoryServices/System.DirectoryServices/PropertyValueCollection.cs
    2005-03-15 01:39:19 UTC (rev 41815)
+++ 
branches/mono-1-0/mcs/class/System.DirectoryServices/System.DirectoryServices/PropertyValueCollection.cs
    2005-03-15 01:40:13 UTC (rev 41816)
@@ -157,25 +157,27 @@
                {
                        get
                        {
-                               if(this.Count==1)
-                               {
-                                       return (object) List[0];
-                               }
-                               else
-                               {
+                               switch (Count) {
+                                       case 0 : 
+                                               return null;
+                                       case 1 :
+                                               return (object) List[0];
+                                       default :
 //                                     System.Object[] oArray= new 
System.Object[this.Count];
 //                                     object[] oArray= new object[this.Count];
 //                                     
Array.Copy((System.Array)List,0,(System.Array)oArray,0,this.Count);
-                                       Array LArray = Array.CreateInstance( 
Type.GetType("System.Object"), this.Count );
-                                       for ( int i = LArray.GetLowerBound(0); 
i <= LArray.GetUpperBound(0); i++ )
-                                               LArray.SetValue( List[i], i );
-                                       return LArray;
+                                               Array LArray = 
Array.CreateInstance( Type.GetType("System.Object"), this.Count );
+                                               for ( int i = 
LArray.GetLowerBound(0); i <= LArray.GetUpperBound(0); i++ )
+                                                       LArray.SetValue( 
List[i], i );
+                                               return LArray;
                                }
                        }
                        set
                        {
                                List.Clear();
-                               Add(value);
+                               if (value != null) {
+                                       Add(value);
+                               }
                        }
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to