System.Xml.XmlConvert.TryToSingle C# (CSharp) Méthode

TryToSingle() static private méthode

static private TryToSingle ( string s, System.Single &result ) : Exception
s string
result System.Single
Résultat System.Exception
        internal static Exception TryToSingle(string s, out Single result)
        {
            s = TrimString(s);
            if (s == "-INF")
            {
                result = Single.NegativeInfinity;
                return null;
            }
            else if (s == "INF")
            {
                result = Single.PositiveInfinity;
                return null;
            }
            else if (!Single.TryParse(s, NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent, NumberFormatInfo.InvariantInfo, out result))
            {
                return new FormatException(SR.Format(SR.XmlConvert_BadFormat, s, "Single"));
            }
            if (result == 0 && s[0] == '-')
            {
                result = -0f;
            }
            return null;
        }