Merge pull request #1502 from madrang/SafeHandle.CloseTestDispose
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls.WebParts / PersonalizableAttribute.cs
index ad48f31795f62e1337cab8a7fa94c49b69da09c5..eeb69120205e5e69c80fd0877de66cabca26d2ae 100644 (file)
@@ -27,7 +27,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if NET_2_0
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -102,18 +101,6 @@ namespace System.Web.UI.WebControls.WebParts
                                this.scope == attr.Scope);
                }
                
-               public static bool Equals (object objA, object objB)
-               {
-                       PersonalizableAttribute attrA = objA as PersonalizableAttribute;
-                       PersonalizableAttribute attrB = objB as PersonalizableAttribute;
-
-                       if (objA == null || objB == null)
-                               return false;
-                       return (attrA.IsPersonalizable == attrB.IsPersonalizable &&
-                               attrA.IsSensitive == attrB.IsSensitive &&
-                               attrA.Scope == attrB.Scope);
-               }
-
                public override int GetHashCode ()
                {
                        return (this.isPersonalizable.GetHashCode () ^
@@ -125,15 +112,18 @@ namespace System.Web.UI.WebControls.WebParts
                {
                        if (type == null)
                                throw new ArgumentNullException ("type");
-
-                       List <PropertyInfo> ret = new List <PropertyInfo> ();
+                       
                        PropertyInfo[] properties = type.GetProperties ();
                        if (properties == null || properties.Length == 0)
-                               return ret;
+                               return new PropertyInfo [0];
+                       List <PropertyInfo> ret = null;
                        
                        foreach (PropertyInfo pi in properties)
-                               if (PropertyQualifies (pi))
+                               if (PropertyQualifies (pi)) {
+                                       if (ret == null)
+                                               ret = new List <PropertyInfo> ();
                                        ret.Add (pi);
+                               }
                        return ret;
                }
 
@@ -172,4 +162,3 @@ namespace System.Web.UI.WebControls.WebParts
                }
        }
 }
-#endif