The best way to initialize multiple Objects of the one Class in C# -
i have app people can enter details console, details stored object, problem don't know how many needed initialization needs happen dynamically. have decided use list right thing use? if not pointers in right direction great.
list fine, assuming object called "inputdata" following
public list<inputdata> inputlist = new list<inputdata>(); public void builder() { string input = console.readline(); inputdata id = new inputdata(input); inputlist.add(id); }
then can iterate through data @ later point foreach
foreach(inputdata in inputlist) { i.dosomething; }
not sure if wanting do, let me know fi have more specific query
Comments
Post a Comment