public string GetStringFromParameters(string url, string apiKey) { var relatedLines = string.Empty; var relatedStops = string.Empty; if (RelatedLines != null && RelatedLines.Count != 0) { relatedLines = string.Join("&", RelatedLines.Select(r => $"relatedLine={r}")); } if (RelatedStops != null && RelatedStops.Count != 0) { relatedStops = string.Join("&", RelatedStops.Select(r => $"relatedStop={r}")); } var names = new List <string>() { "" }; if (Names != null && Names.Count != 0) { names.AddRange(Names.Select(item => "&name=" + item.ToString().ToLower())); } var result = string.Join("", names.ToArray()); return(string.Format(url, relatedLines, relatedStops, result, apiKey)); }
public string GetStringFromParameters(string url, string apiKey) { var relatedLines = string.Empty; var relatedStops = string.Empty; if (RelatedLines != null) { relatedLines = string.Join("&", RelatedLines.Select(r => $"relatedLine={r}")); } if (RelatedStops != null) { relatedStops = string.Join("&", RelatedStops.Select(r => $"relatedStop={r}")); } var trafficInfo = new List <string>(); if (TrafficInformation != null && TrafficInformation.Count != 0) { trafficInfo.AddRange( TrafficInformation.Select(item => "&activateTrafficInfo=" + item.ToString().ToLower())); } var result = string.Join("", trafficInfo.ToArray()); return(string.Format(url, relatedLines, relatedStops, result, apiKey)); }