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


C# Path.AddInPath方法代码示例

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


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

示例1: Main

 static void Main()
 {
     Console.WriteLine("------------------------------Ex.1------------------------------");
     Point3D point = new Point3D(10, 20, 30);
     Console.Write("Override ToString(): ");
     Console.WriteLine(point.ToString());
     //ex2
     Console.WriteLine("------------------------------Ex.2------------------------------");
     Console.WriteLine(Point3D.PointO);
     //ex3
     Console.WriteLine("------------------------------Ex.3------------------------------");
     Console.Write("Distance : ");
     Point3D point1 = new Point3D(0,0,0);
     Point3D point2 = new Point3D(0,3,4);
     Console.WriteLine(CalculateDistance.Calc(point1,point2));
     Console.WriteLine("------------------------------Ex.4------------------------------");
     Path path = new Path();
     path.AddInPath(point1);
     path.AddInPath(point2);
     Console.WriteLine(path.Points[0]);
     PathStorage.SaveData(path);
     Path loadedPath = new Path();
     loadedPath = PathStorage.LoadData();
     Console.WriteLine("The loaded path has points :");
     foreach (var item in loadedPath.Points)
     {
         Console.WriteLine(item);
     }
 }
开发者ID:naturalna,项目名称:OOPPrinciples,代码行数:29,代码来源:PointThreeD.cs

示例2: LoadData

 public static Path LoadData()
 {
     StreamReader reader = new StreamReader(dataPath);
     Path newPath = new Path();
     using (reader)
     {
         //firsl line of the file
         string line = reader.ReadLine();
         while (line != null)
         {
             string[] clearFormat = line.Split(new char[] {'[',']',','});//removing formats
             // list to hold point coordinats
             List<short> pointCoord = new List<short>();
             for (int i = 0; i < clearFormat.Length; i++)
             {
                 if (clearFormat[i] != "")
                 {
                     pointCoord.Add(short.Parse(clearFormat[i]));
                 }
             }
             //creating the point
             Point3D pointForAdd = new Point3D(pointCoord[0],pointCoord[1],pointCoord[2]);
             //adding point in the path
             newPath.AddInPath(pointForAdd);
             //taking the next line in the file
             line = reader.ReadLine();
         }
         return newPath;
     }
 }
开发者ID:naturalna,项目名称:OOPPrinciples,代码行数:30,代码来源:PathStorage.cs


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