internal static string ToJson(TransferLine line)
{
if (line == null)
{
return null;
}
List<string> list = new List<string>();
list.Add(string.Format("\"{0}\":{1}", "endStopIndex", line.EndStopIndex));
if (!string.IsNullOrEmpty(line.EndStopName))
{
list.Add(string.Format("\"{0}\":\"{1}\"", "endStopName", line.EndStopName));
}
list.Add(string.Format("\"{0}\":{1}", "lineID", line.LineID));
if (!string.IsNullOrEmpty(line.LineName))
{
list.Add(string.Format("\"{0}\":\"{1}\"", "lineName", line.LineName));
}
list.Add(string.Format("\"{0}\":{1}", "startStopIndex", line.StartStopIndex));
if (!string.IsNullOrEmpty(line.StartStopName))
{
list.Add(string.Format("\"{0}\":\"{1}\"", "startStopName", line.StartStopName));
}
return "{" + string.Join(",", list) + "}";
}
}