I am trying to add new obj to to list class but is telling me i need obj reference to the property. I cant understand exactly what i should do, can you give me a tip ?
public class CreateContact
{
logic...
}
public class AddedContacts
{
private List<CreateContact> Contact;
public List<CreateContact> ClassCreateContact
{
get { return Contact; }
set { this.Contact = value; }
}
}
I want to create and add to the list the new created "CreateContact" by clicking a button.
private void button4_Click(object sender, EventArgs e)
{
CreateContact p = new CreateContact(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text);
AddedContacts.ClassCreateContact.add(p); // Error 1 An object reference is required for the non-static field, method, or property
}