2007-11-14 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mcs / class / corlib / System / TimeSpan.cs
index adc326f16052b9a8dd0258b3fc1481917c106919..9ae9da02a9444e0b7cb81e033bc606f478aafafa 100644 (file)
@@ -35,6 +35,9 @@ using System.Text;
 namespace System
 {
        [Serializable]
+#if NET_2_0
+       [System.Runtime.InteropServices.ComVisible (true)]
+#endif
        public struct TimeSpan : IComparable
 #if NET_2_0
                , IComparable<TimeSpan>, IEquatable <TimeSpan>
@@ -331,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 {