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

ToInt32() public static méthode

public static ToInt32 ( string s ) : Int32
s string
Résultat System.Int32
        public static Int32 ToInt32(string s)
        {
            return Int32.Parse(s, NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite, NumberFormatInfo.InvariantInfo);
        }

Usage Example

Exemple #1
0
        /// <summary>
        /// Reads the error data in XML attributes.
        /// </summary>

        private static void ReadXmlAttributes(XmlReader reader, Error error)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (!reader.IsStartElement())
            {
                throw new ArgumentException("Reader is not positioned at the start of an element.", "reader");
            }

            error.ApplicationName = reader.GetAttribute("application");
            error.HostName        = reader.GetAttribute("host");
            error.Type            = reader.GetAttribute("type");
            error.Message         = reader.GetAttribute("message");
            error.Source          = reader.GetAttribute("source");
            error.Detail          = reader.GetAttribute("detail");
            error.User            = reader.GetAttribute("user");
            string timeString = Mask.NullString(reader.GetAttribute("time"));

            error.Time = timeString.Length == 0 ? new DateTime() : XmlConvert.ToDateTime(timeString);
            string statusCodeString = Mask.NullString(reader.GetAttribute("statusCode"));

            error.StatusCode         = statusCodeString.Length == 0 ? 0 : XmlConvert.ToInt32(statusCodeString);
            error.WebHostHtmlMessage = reader.GetAttribute("webHostHtmlMessage");
        }
All Usage Examples Of System.Xml.XmlConvert::ToInt32