Ejemplo n.º 1
0
        /// <summary>
        /// Concatenates all the given routes or returns an error when one of the routes cannot be concatenated.
        /// </summary>
        /// <param name="routes"></param>
        /// <returns></returns>
        public static Result <Route> Concatenate(this IEnumerable <Result <Route> > routes)
        {
            Route route = null;
            var   r     = 0;

            foreach (var localRoute in routes)
            {
                if (localRoute.IsError)
                {
                    return(new Result <Route>($"Route at index {r} is in error: {localRoute.ErrorMessage}"));
                }
                route = route == null ? localRoute.Value : route.Concatenate(localRoute.Value);

                r++;
            }
            return(new Result <Route>(route));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Concatenates two routes.
 /// </summary>
 public static Route Concatenate(this Route route1, Route route2)
 {
     return(route1.Concatenate(route2, true));
 }