[System.Web] Public event handlers from reference source
[mono.git] / mcs / class / System.Web / System.Web.UI / PersistenceModeAttribute.cs
index f1081e89788572fd168419e0b51ddeccdb69ac01..82178ef3f55bfeb899e400d75997a23187f351a4 100644 (file)
@@ -4,8 +4,7 @@
 // Duncan Mak  (duncan@ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Security.Permissions;
 
 namespace System.Web.UI {
 
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
        [AttributeUsage (AttributeTargets.All)]
        public sealed class PersistenceModeAttribute : Attribute
        {
@@ -62,10 +64,11 @@ namespace System.Web.UI {
 
                public override bool Equals (object obj)
                {
-                       if (!(obj is PersistenceModeAttribute))
+                       PersistenceModeAttribute pma = (obj as PersistenceModeAttribute);
+                       if (pma == null)
                                return false;
 
-                       return ((PersistenceModeAttribute) obj).mode == mode;
+                       return (pma.mode == mode);
                }
 
                public override int GetHashCode ()