If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Threaded View

Hey guys kind of a simple question, I'm not exactly sure where/how to initialize a new object instance so I don't get this error. I have a class object(Contact) that has another class object(ContactInfo) and sometimes the user decides not to input(instantiate) the ContactInfo object. So later when I try to do a search via Contact.ContactInfo, I get the error. Below I have the line of code where I get the error and then I have the two classes:
foreach (var Contact in Contacts)
{
if (String.Equals(Contact._contactInfo.City.ToLower(), city, StringComparison.CurrentCulture))
{
ContactsByCity.Add(Contact);
}
}