Contents tagged with Parse Int

  • Convenient parsing of XML nodes in C#

    Hello everybody,

    today I want to share with you code that I use in order to conveniently to parse different xml nodes in C#. 

    Take a look at this class:

    public static class XmlNodeProcessor

        {

            public static int? ParseInt(this string s)

            {

                if (string.IsNullOrEmpty(s))

                {

                    return null;

                }

                return int.Parse(s);

            }

            public static long? ParseLong(this string s)

            {

                if (string.IsNullOrEmpty(s))

                {

                    return null;

                }

                return long.Parse(s);

            }

            public static Guid? ParseGuid(this string s)

            {

          … more