Hello,
I have a list of values in the following format:
I would like to be able to create objects with the name in the first column (i.e, A12 or E67) and have each object contain indexable/searchable attributes from the second and fourth columns (i.e., A12.BC3 = 5.678 & E67.FG89 = 34.567). However, I'm not very good at objects.Code:A12 BC3 4D 5.678 9.123 45 E67 FG89 12H 34.567 8.912 3
Right now I have the following code to try to separate the entries:
Code:using (StreamReader sr = new StreamReader(fs)) { while ((line = sr.ReadLine()) != null) { manip = line.Split(' '); foreach (string aline in manip) { bool hasvalue = CheckForEntry(aline); if (hasvalue == true) { Console.WriteLine("The next entry is {0}", aline); Console.ReadLine(); counter++; //resets counter if (counter == 6) { counter = 1; } if (counter == 1) { residuename = aline; Residue residuename = new Residue(); //how to do this correctly?? } } } } }One of my problems is that I'm trying to create a new Residue class called whatever "aline" happens to be at the time and the way I'm doing it now is obviously wrong. Another problem is that my compiler says that public Shift (float shift) must have a return type. Could someone please help me out?Code:public class Residue public class Atom { { public float Shift {get; set;} public Shift(float shift) { Shift = shift; } } }
Thanks!




Reply With Quote