I wish to dynamically create and name instances of my object at runtime as I add them to a list class I somehow thought this would be a simple matter in c# but thus far I have been unable to find any information on how to achieve this.
for the brief description I have a custom class that during runtime I wish to create an array list and populate it with objects of the custon class but name the objects as they’re being added to the list using the loop index and a standard name.
Is this possible?
You can either have a list that allows you to access its elements by an index or have a dictonary that allows you the same with any particular type:
For example, if you want your dictionary with a string key (“name”):
Unlike in PHP, there’s no inbuilt collection type in C# that allows you to access its members by both an index or a key. You can always create your own though.