I have an "Address" class, and make 10 instances of it like so:
Address ad1 = new Address(){
OwnerId = 1,
Street = "Papanikolaou 3",
ProvinceId = 1,
PostalCode = "13245",
TownId = 1,
CountryId = 1,
TypeId = 1,
Active = true
};
Every new object name only has the number at the end of the name changed. In example:
Address ad2 = new Address();
Address ad3 = new Address();
And so on...
Next i want to add all those objects into a list. Since the object names are similar could i use a "for" loop, and use the loop counter in order to "change" the object name, since every instance name of the "Address" class is so similar?
E.G(I know this won't work):
List<Address> lst = new List<Address>();
for(i = 1; i <= 10; i++) {
lst.add(adi);
}