RTools.Util.IntToken.Parse C# (CSharp) Метод

Parse() приватный Метод

Convert the input string to an integer, if possible
private Parse ( string s ) : void
s string The string to parse.
Результат void
        private void Parse(string s)
        {
            // try base 10 separately since it will be the most
            // common case
            try
            {
                obj = Int32.Parse(s);
                return;
            }
            catch (Exception)
            {
                // try 64 bit base 10
                try
                {
                    obj = Int64.Parse(s);
                    return;
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception: {0}", e);
                }  // don't give up yet
            }

            // not a normal int, try other bases
            int[] bases = { 16, 2, 8 };
            foreach (int b in bases)
            {
                try
                {
                    obj = Convert.ToInt32(s, b);
                    return;
                }
                catch
                {
                    // try 64 bit base 10
                    try
                    {
                        obj = Convert.ToInt64(s, b);
                        return;
                    }
                    catch { } // don't give up yet
                }
            }

            obj = null;
        }