I am trying to make a list of a type class (I would use a struct but I read this doesn't work for return reasons) and I'm not sure how to access the field of the class. I have tried a bit of trial and error such as

myList.Add.myfield()

and

myList.Add(.myfield)

however I'm still unsuccessful! Would really appreciate if someone could help!

Ummm I am a bit confused by your code. But to make a list of classes:

class myClass
{
   //Class implementation
}

//now to make a list of this class somewhere else...
List<myClass> myClassList = new List<myClass>();
myClass myClassInstance = new myClass(/*ctor stuff*/);
myClassList.Add(myClassInstance);

//or, alternatively
myClassList.Add(new myClass(/*CTOR stuff*/));
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.