To me the fact you are using it a for a lookup means it is a property.
That's an inaccurate conclusion. One does not imply the other. If you look at the data through SQL colored glasses, then you are right -- the key is a property of a row. But that is not true in general.
To me anything you search on would be a legitimate property of the class.
Once again, that's true if you look from an SQL point of view but it is not true in general data model.
Could a lookup key not be considered a property of the class?
Let me give you an example from a CAD point of view. A Part can have various properties - mass, volume, surface area, density, etc. They can all be stored in a map using
std::map<std::string, quantity> (
quantity represents a number and a unit). In this case, it does make sense to make "mass" a property of a
quantity represents just a number and a unit. That it can be used to capture the mass of a Part does not change what the
quantity abstraction is.
Yes lookup/search has gone from O(1) to O(n) but has
MyClassWithName violated anything?
You define a class called
MyClassWithName only if it makes sense as a type, not as way to capture the name in a list that obviates the need for a map/dictionary for lookup purposes. Besides, you could go ahead and use a
Dictionary<string, List<MyClassWithName>> to make the lookup more efficient.