I'm trying to use a property of individual object instances stored within a List<T>
object, but I can't seem to access the properties directly.
I have an object (sportsCarVehicle
) which stores a user-defined name (strVehicleName
) (amongst other properties, but that's not important) within itself. The object is then stored within a List<sportsCarVehicle>
object called sportsCarVehicleStorage
.
I need to access every instance of sportsCarVehicle
in List<sportsCarVehicle>
and pass the value of strVehicleName
to a combo box on a form.
I assume I'll need some kind to loop to cycle through each instance and pass the name to the combo box, but my main issue is not being able to access the property I need. The sportsCarVehicle
instances have no reference-able name.
One more thing I should note: the constructor for sportsCarVehicle
is called within the sportsCarVehicleStorage.Add()
method.
Any suggestions on how I could do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…