示例#1
0
        public PathSegments RelativeTo(PathSegments other, bool caseSensitive)
        {
            var i = 0;

            while (i < _segments.Count && i < other._segments.Count && Equal(_segments[i], other._segments[i], caseSensitive))
            {
                i++;
            }
            if (i == 0)
            {
                return(null);
            }
            return(From(i));
        }
示例#2
0
        public PathSegments Combine(PathSegments other)
        {
            if (IsEmpty)
            {
                return(other);
            }
            if (other.IsEmpty)
            {
                return(this);
            }
            if (!other.IsRelative)
            {
                return(other);
            }
            var list = new List <string>(_segments.Count + other._segments.Count);

            list.AddRange(_segments);
            list.AddRange(other._segments);
            return(Create(list));
        }