I have the following class:
public class EmailData
{
public string FirstName{ set; get; }
public string LastName { set; get; }
public string Location{ set; get; }
}
I then did the following but was not working properly:
List<EmailData> lstemail = new List<EmailData>();
lstemail.Add("JOhn","Smith","Los Angeles");
I get a message that says no overload for method takes 3 arguments.
If you want to instantiate and add in the same line, you’d have to do something like this:
or just instantiate the object prior, and add it directly in: