@Magnus Exactly. For a set of "properties" (in the general sense, i.e., data) of the same type -- here: string -- it makes more sense to have a dictionary indexed with a suitable enum. This makes loops without reflection trivial. One may even opt for an enum enumerating every field, regardless of type, and have a dictionary with objects or some general custom class in it; that is suitable for loops that perform operations that are valid for all of them, e.g. toString (to hold them in GUI widgets) or store them somewhere etc..
↧