当前位置: 首页>>代码示例>>C#>>正文


C# Path.AddPointInList方法代码示例

本文整理汇总了C#中Path.AddPointInList方法的典型用法代码示例。如果您正苦于以下问题:C# Path.AddPointInList方法的具体用法?C# Path.AddPointInList怎么用?C# Path.AddPointInList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path的用法示例。


在下文中一共展示了Path.AddPointInList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadPaths

 // Load path Method
 public static List<Path> LoadPaths()
 {
     Path newPath = new Path();
     List<Path> listOfPaths = new List<Path>();
     StreamReader reader = new StreamReader("../../LoadPoints.txt");
     using (reader)
     {
         string line = reader.ReadLine();
         while (line != null)
         {
             if (line != "end")
             {
                 Point3D point = new Point3D();
                 string[] points = line.Split(',');
                 point.x = int.Parse(points[0]);
                 point.y = int.Parse(points[1]);
                 point.z = int.Parse(points[2]);
                 newPath.AddPointInList(point);
             }
             else
             {
                 listOfPaths.Add(newPath);
                 newPath = new Path();
             }
             line = reader.ReadLine();
         }
     }
     return listOfPaths;
 }
开发者ID:GStoykov,项目名称:TelerikAcademyHomeworks,代码行数:30,代码来源:PathStorage.cs

示例2: Main

    static void Main(string[] args)
    {
        Point3D a = new Point3D(1, 1, 1);
        Point3D b = new Point3D(2, 2, 2);
        //Console.WriteLine(PointDistance.Distance(a, b));

        // Saving list of points in a text file
        Path file = new Path();
        file.AddPointInList(a);
        file.AddPointInList(b);
        PathStorage.SavePaths(file);

        // Loading list of points from a text file
        List<Path> listOfPaths = PathStorage.LoadPaths();
        foreach (var path in listOfPaths)
        {
            Console.WriteLine("Point List:");
            foreach (var point in path.ListOfPoints)
            {
                Console.WriteLine(point);
            }
        }
    }
开发者ID:GStoykov,项目名称:TelerikAcademyHomeworks,代码行数:23,代码来源:Program.cs


注:本文中的Path.AddPointInList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。