2007-11-14 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mcs / class / corlib / System / TimeSpan.cs
index a9cab017bc7b403a009e55413d1a1b6ab3d9db81..9ae9da02a9444e0b7cb81e033bc606f478aafafa 100644 (file)
@@ -35,11 +35,12 @@ using System.Text;
 namespace System
 {
        [Serializable]
-       public struct TimeSpan :
 #if NET_2_0
-               IComparable, IComparable<TimeSpan>
-#else
-               IComparable
+       [System.Runtime.InteropServices.ComVisible (true)]
+#endif
+       public struct TimeSpan : IComparable
+#if NET_2_0
+               , IComparable<TimeSpan>, IEquatable <TimeSpan>
 #endif
        {
                public static readonly TimeSpan MaxValue = new TimeSpan (long.MaxValue);
@@ -333,6 +334,19 @@ namespace System
                        return p.Execute ();
                }
 
+#if NET_2_0
+               public static bool TryParse (string s, out TimeSpan result)
+               {
+                       try {
+                               result = Parse (s);
+                               return true;
+                       } catch {
+                               result = TimeSpan.Zero;
+                               return false;
+                       }
+               }
+#endif
+
                public TimeSpan Subtract (TimeSpan ts)
                {
                        try {