如何用带字母的数字来计算(?)索引元素

时间:2015-08-05 07:57:10

标签: c# devexpress bing-maps

我有以下代码,我想命名waypoins [NodeIndex]的索引元素,如果NodeIndex == 0,则将其命名为"起始节点:A" 如果NodeIndex == 1,则" B",NodeIndex == 2 as" C"等等。我不知道该怎么做。

string waypointString = "38.481713 , 27.088842 ; 38.477967 , 27.095194 ; 38.468979 , 27.109935 ; 38.473381 , 27.112424 ; 38.459930 , 27.090800 ;38.469622 , 27.075265 ; 38.455494 , 27.119999 ; 38.451671 , 27.114656 ; 38.469483 , 27.134998 ; 38.468074 , 27.085409";

        string[] Nodes = waypointString.Split(';');
        DevExpress.XtraMap.GeoPoint[] waypoints = new DevExpress.XtraMap.GeoPoint[Nodes.Length];

        int NodeIndex = -1;

        foreach (string Node in Nodes)
        {

            string[] Coordinates = Node.Split(',');
            NodeIndex++;
            waypoints[NodeIndex] = new DevExpress.XtraMap.GeoPoint();
            waypoints[NodeIndex].Latitude = double.Parse(Coordinates[0].Trim());
            waypoints[NodeIndex].Longitude = double.Parse(Coordinates[1].Trim());

        }

非常感谢任何形式的帮助。

1 个答案:

答案 0 :(得分:0)

感谢@EZI,使用Dictionary<string,GeoPoint>

解决了这个问题