title: read triangle coordinates from a text file and put them in triangle class C#
body: <p>What I'm trying to do is to read triangle coordinates from a text file named "p102_triangles" whose data is like this:  </p>
  
  <blockquote>
    <p>-340,495,-153,-910,835,-947<br>
    -175,41,-421,-714,574,-645<br>
    -547,712,-352,579,951,-786<br>
    419,-864,-83,650,-399,171<br>
    -429,-89,-357,-930,296,-29<br>
    -734,-702,823,-745,-684,-62<br>
    ... </p>
  </blockquote>
  
  <p>What I did so far is making a triangle class accepting three Point type values for all the vertices. Each of these points have their own (x,y) coordinates. Then I read the file line by line. In each line I separate the comma separated values, convert them to integer and store them in an array of size 6 (each triangle has 6 coordination for 3 vertices). I make an object of class triangle and assign this values to each object. So basically after each line an objec of triangle is created. This is my code which works the way I want.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using System.IO;
  
  namespace triangleContainment
  {
      //Triangle class
      public class triangle
      {
          public Point point1;
          public Point point2;
          public Point point3;
          public triangle(Point point1, Point point2, Point point3)
          {
              this.point1 = point1;
              this.point2 = point2;
              this.point3 = point3;
          }
      }
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          //Global variables
          List&lt;int&gt; pos = new List&lt;int&gt;(new int[6]);
          List&lt;triangle&gt; triangle = new List&lt;triangle&gt;(new triangle[10000]);
          private void readValues() //start of reading file function
          {
              char[] delimiterChars = { ',' };
              System.IO.StreamReader file = new System.IO.StreamReader(@"C:\Users\DaVinci\Google Drive\C# Cloud\triangleContainment\triangleContainment\p102_triangles.txt");
  
              string line;
              int index = 0;
              while ((line = file.ReadLine()) != null)
              {
                  string[] values = line.Split(delimiterChars);
                  int i = 0;
                  foreach (string v in values)
                  {
                      pos[i] = Int32.Parse(v);
                      i++;
                  }
                  triangle[index] = new triangle(new Point(pos[0], pos[1]), new Point(pos[2], pos[3]), new Point(pos[4], pos[5]));
                  index++;
              }
  
          }//end of reading file function
          private void Form1_Load(object sender, EventArgs e)
          {
              readValues();
          }
      }
  }
  </code></pre>
  
  <p>Since I'm new to C# I just did it out of scratch. How can I make it better or shorter? How can I define my triangle class more efficient? Can I use anything other than collections? </p>