Пример #1
0
        // Convert a path specified as a string to a DPath.
        // Does not support individual path segments that contain '.' and '!' characters.
        public static bool TryParse(string dotted, out DPath path)
        {
            Contracts.AssertValue(dotted);

            path = DPath.Root;

            if (dotted == string.Empty)
            {
                return(true);
            }

            foreach (var name in dotted.Split('.', '!'))
            {
                if (!DName.IsValidDName(name))
                {
                    path = DPath.Root;
                    return(false);
                }
                path = path.Append(new DName(name));
            }

            return(true);
        }
Пример #2
0
 public readonly DPath Append(DName name)
 {
     Contracts.Assert(name.IsValid);
     return(new DPath(this, name));
 }