[longomatch] Fix Hotkey Equal(object obj) method. When comparing to an object, check first if has the right type



commit dce045ec9a578c832702ef5d5d4349611930da3c
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Dec 23 04:12:32 2009 +0100

    Fix Hotkey Equal(object obj) method.
    	When comparing to an object, check first if has the right type

 LongoMatch/Time/HotKey.cs |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch/Time/HotKey.cs b/LongoMatch/Time/HotKey.cs
index 85d5767..81db5dd 100644
--- a/LongoMatch/Time/HotKey.cs
+++ b/LongoMatch/Time/HotKey.cs
@@ -22,6 +22,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Runtime.Serialization;
 using Gtk;
 using Gdk;
 using Mono.Unix;
@@ -105,9 +106,10 @@ namespace LongoMatch.TimeNodes
 		#region Overrides
 		public override bool Equals(object obj)
 		{
-			HotKey hotkey= obj as HotKey;
-			if (hotkey != null)
+			if (obj is HotKey){
+				HotKey hotkey= obj as HotKey;
 				return Equals(hotkey);
+			}
 			else
 				return false;
 		}
@@ -129,6 +131,6 @@ namespace LongoMatch.TimeNodes
 
 			return string.Format("<{0}>+{1}", modifierS,(Key.ToString()).ToLower());
 		}
-		#endregion
+		#endregion	
 	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]