public IMatchRoutes MakeRelativeTo(NonNullList <NonBlankTrimmedString> parentSegments) { if (parentSegments == null) { throw new ArgumentNullException("parentSegments"); } if (!parentSegments.Any()) { return(this); } var newSegments = _segments; foreach (var segment in parentSegments.Reverse()) { newSegments = newSegments.Insert(segment); } return(new StaticRouteDetails(newSegments, _ifMatched)); }
public IMatchRoutes MakeRelativeTo(NonNullList <NonBlankTrimmedString> parentSegments) { if (parentSegments == null) { throw new ArgumentNullException("parentSegments"); } if (!parentSegments.Any()) { return(this); } var newSegmentMatchers = _segmentMatchers; foreach (var segment in parentSegments.Reverse()) { newSegmentMatchers = newSegmentMatchers.Insert(new FixedSegmentMatcher <TValues>(segment)); } return(new VariableRouteDetails(newSegmentMatchers, _extractedValueBuilder, _ifMatched)); }