Example #1
0
        //<summary>Will return false if parsing could not perform</summary>
        public static bool TryParse(string input, out Id result)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            var parser = new UniqueIdParser(input);

            return(parser.Parse(out result));
        }
Example #2
0
        //<summary>Initialize with a string Guid value</summary>
        public Id(string g)
        {
            CheckNull(g);
            g = g.Trim();
            var parser = new UniqueIdParser(g);

            Id guid;

            if (!parser.Parse(out guid))
            {
                throw CreateFormatException(g);
            }

            this = guid;
        }
Example #3
0
        //<summary>A more stringent version of Parse.  Will throw exception if parsing is not successful</summary>
        public static bool TryParseExact(string input, string format, out Id result)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            if (format == null)
            {
                throw new ArgumentNullException("format");
            }

            var parser = new UniqueIdParser(input);

            return(parser.Parse(ParseFormat(format), out result));
        }