/// <summary> /// Calcula o valor e tambem todos os trechos percorridos /// </summary> /// <param name="result">Enumeração com a lista de Stretch(Trecho) a ser calculada</param> /// <param name="to">Destino</param> /// <returns>Retorna uma string com os trechos encontrados e a somatoria dos valores entres eles.</returns> private void Calculate(Stretch result, Route route, ref Route routeAviable) { routeAviable.AddValue(result.value); routeAviable.AddStretch(result); if (route.To.AirPort != result.to.AirPort) { var next = allStretch.Where(x => x.from.AirPort == result.to.AirPort).FirstOrDefault(); if (next != null) { Calculate(next, route, ref routeAviable); } } }