Have a look at string.split to get your array size and the data you need.
In this sample the file format is:
1.2 2.3 4.5, 1.2 3.4 2.3, 4.3 3.3 1.7, 8.2 1.2 3.6
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using Autodesk.AutoCAD.Runtime;
using AcAp = Autodesk.AutoCAD.ApplicationServices;
using AcGe = Autodesk.AutoCAD.Geometry;
[assembly: CommandClass(typeof(ExecMethod.Commands))]
//// ++--
namespace ExecMethod
{
public class MyDataDict : Dictionary<int, List<AcGe.Point3d>>
{
public MyDataDict() { }
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("(");
foreach (KeyValuePair<int, List<AcGe.Point3d>> item in this)
{
sb.Append("(");
sb.Append(String.Format("{0}", item.Key));
sb.Append(", ");
foreach (AcGe.Point3d d in item.Value)
{
sb.Append(d.ToString());
sb.Append(", ");
}
sb.Remove(sb.Length - 2, 2);
sb.Append(")");
}
sb.Append(")");
return sb.ToString();
}
}
public static class Commands
{
public static MyDataDict createCoordsDict(char separator)
{
string fileName = "C:\\Coords.TXT" /*getFileWithAcadDialog()*/;
MyDataDict dict = new MyDataDict();
using (TextReader streamReader = new StreamReader(fileName))
{
int cntr = 0;
while (true)
{
string lineRead = streamReader.ReadLine();
if (string.IsNullOrEmpty(lineRead))
{
break;
}
string[] pointstr = lineRead.Trim().Split(separator);
List<AcGe.Point3d> ptList = new List<AcGe.Point3d>();
foreach (string str in pointstr)
{
string[] doublestr = str.Trim().Split();
if (doublestr.Length == 3)
{
double[] pt = new double[3];
for (int i = 0; i < 3; i++)
{
double d;
if (double.TryParse(doublestr[i], out d))
{
pt[i] = d;
}
}
ptList.Add(new AcGe.Point3d(pt));
}
else
{
throw new System.Exception("\nBad File Format!");
}
}
dict.Add(cntr++, ptList);
}
}
return dict;
}
[CommandMethod("doit")]
public static void doit()
{
AcAp.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\n{0}", createCoordsDict(','));
}
}
}