Sorthing? c#


So I’m making a ai that will do takes based on their needs, e.g., food levels are low, go to shops. But for this to work, I need something to list the tasks they will do, and do the ones in order based on what they need most. So I wanted to know what would be the best way to do this. A list, 2d array? Also, I need a way to sort it.

Any ideas


How about making a Need class and implement the IComparable interface? Then you could write your custom code for how to compare two Needs in the CompareTo method, and just use regular list sorting to find out which Need is the most important.

Bit of info on IComparable: