[longomatch] Add == and != operators to Time



commit cd33121ec18268b7217bf81586128fa6e85a0ae6
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Feb 26 21:16:22 2015 +0100

    Add == and != operators to Time

 LongoMatch.Core/Store/Time.cs |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Core/Store/Time.cs b/LongoMatch.Core/Store/Time.cs
index 7500f55..7eefbcd 100644
--- a/LongoMatch.Core/Store/Time.cs
+++ b/LongoMatch.Core/Store/Time.cs
@@ -158,6 +158,23 @@ namespace LongoMatch.Core.Store
                #endregion
 
                #region Operators
+               public static bool operator == (Time t1, Time t2)
+               {
+                       if (Object.ReferenceEquals (t1, t2)) {
+                               return true;
+                       }
+                       
+                       if ((object)t1 == null || (object)t2 == null) {
+                               return false;
+                       }
+                       
+                       return t1.Equals (t2);
+               }
+               
+               public static bool operator != (Time t1,Time t2) {
+                       return ! (t1 == t2);
+               }
+
                public static bool operator < (Time t1,Time t2) {
                        return t1.MSeconds < t2.MSeconds;
                }


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