2006-08-05 Duncan Mak <duncan@novell.com>
[mono.git] / mcs / class / corlib / System / Char.cs
index 75d320e35b34a5398fe99a788efa94ccb9d9420a..fc5e0de8e412cb89e8a4dc94bc089a1a8a179cc7 100644 (file)
@@ -570,6 +570,19 @@ namespace System
                        return IsWhiteSpace (str[index]);
                }
 
+#if NET_2_0
+               public static bool TryParse (string s, out char result)
+               {
+                       if (s == null || s.Length != 1) {
+                               result = (char) 0;
+                               return false;
+                       }
+
+                       result = s [0];
+                       return true;
+               }
+#endif
+
                public static char Parse (string str)
                {
                        if (str == null)