public int MatchOther(ASplit other) { return _segments.Count(other.HasSegment); }
private SingleRoute find_route(string path) { var split = new ASplit(path); int bestMatch = -1; SingleRoute bestRoute = null; foreach (var route in _routes.Values) { int hasToBeThereSegments = route.Split.Segments.Length; int match = split.MatchOther(route.Split); if (match >= hasToBeThereSegments) // can happen if url has same segments, // fe: /trading/affiliate/35273/user/get/trading/options if (match > bestMatch) { bestMatch = match; bestRoute = route; } } return bestRoute; }