You could do something like this
var locations = [ { <%= string.Join("},\n{",
locations.Select(l => string.Format("Longitude: {0}, Latitude: {1}",
l.Longitude.ToString(),
l.Latitude.ToString()))) %> } ]
for (var i = 0; i < locations.length; i++) {
var Longitude = locations[i].Longitude;
var Latitude = locations[i].Latitude;
}
This assumes that you have a class like
public class Location
{
public int Longitude { get; set; }
public int Latitude { get; set; }
}
and locations is IEnumerable may be like this
var locations = new List<Location> {
new Location { Longitude = 10, Latitude = 20 },
new Location { Longitude = 11, Latitude = 21 },
new Location { Longitude = 12, Latitude = 22 }
};