List<GeoCoordinate> mycoord = new List<GeoCoordinate>();
mycoord.add(MyGeoPosition);
But you need to write mycoord as class member, not as automatic variable.
質問
I'm trying to save coordinates to a list of some type so that I can store them for future manipulation within the application but I'm not sure how I would go about this. In the onNavigatedTo method of the application I have a GeoCoordinate variable MyGeoPosition
that I want to store.
Can someone show me how I would achieve this and what type of list to use for this issue?
This is the complete method:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (NavigationContext.QueryString.ContainsKey("GeoLat") && NavigationContext.QueryString.ContainsKey("GeoLong") && NavigationContext.QueryString.ContainsKey("pName"))
{
var latitude = Convert.ToDouble(NavigationContext.QueryString["GeoLat"]);
var longtitude = Convert.ToDouble(NavigationContext.QueryString["GeoLong"]);
var MyGeoPosition = new GeoCoordinate(latitude, longtitude);
var pushPinName = NavigationContext.QueryString["pName"];
DrawPushPin(MyGeoPosition,pushPinName);
}
base.OnNavigatedTo(e);
}
解決
List<GeoCoordinate> mycoord = new List<GeoCoordinate>();
mycoord.add(MyGeoPosition);
But you need to write mycoord as class member, not as automatic variable.
他のヒント
You should just use a list of type
var mycoord = new List<GeoCoordinate>();
mycoord.Add(mycoord);