DRAG DROP
You are developing a class named Temperature.
You need to ensure that collections of Temperature objects are sortable.
How should you complete the relevant code segment? (To answer, drag the appropriate code
segments to the correct locations in the answer are
a. Each code segment may be used once, more than once, or not at all. You may need to drag the
split bar between panes or scroll to view content.)

correct
3
0
it says: “You need to ensure that collections of Temperature objects are sortable.”, but nothing about how to sort (ascending or descending).
so if ascending then
return otherTemperature.Fahrenheit.CompareTo(this.Fahrenheit);
if descending then
return this.Fahrenheit.CompareTo(otherTempereature.Fahrenheit);
1
0
oops rushed myself
Ascending:
___________return this.Fahrenheit.CompareTo(otherTempereature.Fahrenheit);
Descending:
___________return otherTemperature.Fahrenheit.CompareTo(this.Fahrenheit);
0
0
You should always use ascending in CompareTo().
If you use “return otherTemperature.Fahrenheit.CompareTo(this.Fahrenheit)” then code
temperaturesList.OrderByDescending(x => x); sorts collection ascending. If this is what you want, can do this…
0
1