JetBrains Rider
 
Get JetBrains Rider
You are viewing the documentation for an earlier version of JetBrains Rider.

Generate Relational Members

Last modified: 08 March 2021

Code | Generate | Relational Members

Alt+Insert | Relational Members

JetBrains Rider helps you automatically overload relational operators and implementations of related interfaces using selected fields and properties. By default, JetBrains Rider will create an implementation of IComparable<T>, and optionally, operators >, <, and as well as an implementation of IComparable are generated too.

In the example below, this command is used to generate relational members that takes into account int _birthYear and string _name fields when to compare objects of the Person class.