Created
June 6, 2015 17:06
-
-
Save alagalia/03cf1e3f065e4b542cba to your computer and use it in GitHub Desktop.
Defining Class to collect a List<OnotherClass>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using _01Point3D; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Path | |
{ | |
class PathMain | |
{ | |
static void Main(string[] args) | |
{ | |
Point3D point1 = new Point3D(1, 4, 1); | |
Point3D point2 = new Point3D(-4, 10, 2); | |
Point3D point3 = new Point3D(4, 1, 2); | |
Point3D point4 = new Point3D(); | |
List<Point3D> list = new List<Point3D>() { point1, point2, point3 }; | |
Path3D path1 = new Path3D(list); | |
Path3D path2 = new Path3D(new List<Point3D>() { point4, point1 }); | |
Console.WriteLine(path1); | |
Console.WriteLine(path2); | |
} | |
} | |
class Path3D | |
{ | |
public List<Point3D> pointsInPath { get; set; } | |
//ctor | |
public Path3D(List<Point3D> points) | |
{ | |
this.pointsInPath = points; | |
} | |
public override string ToString() | |
{ | |
StringBuilder sb = new StringBuilder(); | |
foreach (var item in pointsInPath) | |
{ | |
sb.Append(item + " |"); | |
} | |
return sb.ToString(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment