Просмотр исходного кода

ChangeLog: Updated ChangeLog.
ThemeableAttribute.cs:
FilterableAttribute.cs: Code scrubbing and optimization.

svn path=/trunk/mcs/; revision=34348

Sanja Gupta 21 лет назад
Родитель
Сommit
8f5ed0c67f

+ 5 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,3 +1,8 @@
+2009-09-24 Sanjay Gupta <[email protected]>
+
+	* ThemeableAttribute.cs:
+	* FilterableAttribute.cs: Code scrubbing and optimization.
+
 2009-09-14 Sanjay Gupta <[email protected]>
 
 	* ThemeableAttribute.cs: Completed implementation.

+ 11 - 18
mcs/class/System.Web/System.Web.UI/FilterableAttribute.cs

@@ -61,8 +61,7 @@ namespace System.Web.UI {
 		
 		private void Dispose (bool disposing)
 		{
-			if (!this.dispose)
-			{
+			if (!this.dispose) {
 				//Do nothing
 				this.dispose = true;
 			}
@@ -70,8 +69,7 @@ namespace System.Web.UI {
 
 		public override bool Equals (object obj)
 		{
-			if (obj != null && obj is FilterableAttribute)
-			{
+			if (obj != null && obj is FilterableAttribute) {
 				FilterableAttribute fa = (FilterableAttribute) obj;
 				return (this.filterable == fa.filterable);
 			}
@@ -95,30 +93,25 @@ namespace System.Web.UI {
 
 		public static bool IsPropertyFilterable (PropertyDescriptor propDesc)
 		{
-			System.ComponentModel.AttributeCollection ac = propDesc.Attributes;
-			if (ac.Count != 0)
-			{
-				foreach (Attribute attrib in ac)
-					if (attrib.GetType () == FilterableAttribute.Default.GetType ())
+			System.ComponentModel.AttributeCollection attributes = propDesc.Attributes;
+			if (attributes.Count != 0) {
+				foreach (Attribute attrib in attributes)
+					if (attrib is FilterableAttribute)
 						return true;
 			}
-			return false;
-			
+			return false;			
 		}
 
 		public static bool IsTypeFilterable (Type type)
 		{
-			Object [] ac = type.GetCustomAttributes (false);
-			if (ac.Length != 0)
-			{
-				foreach (Attribute attrib in ac)
-					if (attrib.GetType () == FilterableAttribute.Default.GetType ())
+			Object [] attributes = type.GetCustomAttributes (typeof (FilterableAttribute), false);
+			if (attributes.Length != 0) {
+				foreach (Attribute attrib in attributes)
+					if (attrib is FilterableAttribute)
 						return true;
 			}
 			return false;			
 		}
-
-
 	}
 }
 #endif

+ 7 - 9
mcs/class/System.Web/System.Web.UI/ThemeableAttribute.cs

@@ -62,8 +62,7 @@ namespace System.Web.UI {
 		
 		private void Dispose (bool disposing)
 		{
-			if (!this.dispose)
-			{
+			if (!this.dispose){
 				//Do nothing
 				this.dispose = true;
 			}
@@ -71,8 +70,7 @@ namespace System.Web.UI {
 
 		public override bool Equals (object obj)
 		{
-			if (obj != null && obj is ThemeableAttribute)
-			{
+			if (obj != null && obj is ThemeableAttribute) {
 				ThemeableAttribute ta = (ThemeableAttribute) obj;
 				return (this.themeable == ta.themeable);
 			}
@@ -91,16 +89,16 @@ namespace System.Web.UI {
 
 		public static bool IsObjectThemeable (object obj)
 		{
+			
 			return IsTypeThemeable (obj.GetType ());
 		}
 
 		public static bool IsTypeThemeable (Type type)
 		{
-			Object [] ac = type.GetCustomAttributes (false);
-			if (ac.Length != 0)
-			{
-				foreach (Attribute attrib in ac)
-					if (attrib.GetType () == ThemeableAttribute.Default.GetType ())
+			Object [] attributes = type.GetCustomAttributes (typeof (ThemeableAttribute), false);
+			if (attributes.Length != 0) {
+				foreach (Attribute attrib in attributes)
+					if (attrib is ThemeableAttribute)
 						return true;
 			}
 			return false;