I have this class in C#:
public class Init
{
public string First_name { get; set; }.
public List<LeadLocations> Locations { get; set; }
}
public Init()
{
this.Locations = new List<LeadLocations>();
}
public class LeadLocations
{
public string City { get; set; }
public string State { get; set; }
public string County { get; set; }
}
I need to fill Locations with values that I have in another list like:
foreach (var item2 in AreaOfInterest.AreaOfInterests)
{
foreach (var item in transactionInit.Locations)
{
item.City = item2.City;
item.County = item2.County;
}
}
but it never goes to second foreach as it is empty. How I can initialize it to new object, anything I try is not working.
AreaOfInterest.AreaOfInterestsis empty. Find out why.AreaOfInterest.AreaOfInterestsinitialized and populated. Does your break point get hit on this lineforeach (var item in transactionInit.Locations)