The example uses the firstWidget variable to store the ID that occurs first in the sort order. It compares each ID that it generates with the firstWidget value. If the new value precedes the current value of firstWidget in the sort order, the example calls the Exchange<T> method to assign the new value to firstWidget.