There is a class that contains a large number of fields (> 50). There is a collection that contains elements of this class. You need to implement a method that sorts this collection by the specified field. A field is set by passing a string with the name of the desired field to the method. In this case, the class may later be added to the class. The method should sort the collection by new fields without changing the method itself. Using IComparer and reflection is not suitable. Is there any other way to access the field of an object by its name?
Clarification: IComparer cannot be implemented for the class itself, comparison is available for field class types.