Coffeehouse Post

Single Post Permalink

View Thread: The New Channel 9 Editor
  • User profile image
    Manabi

    Sven Groot said:

    Just testing source code formatting:

    private void DownHeap(int index)
    {
        T item = _heap[index];
        int count = _heap.Count;
        int firstChild = (index << 1) + 1;
        int secondChild = firstChild + 1;
        int smallestChild = (secondChild < count && Comparer.Compare(_heap[secondChild], _heap[firstChild]) < 0) ? secondChild : firstChild;
        while( smallestChild < count && Comparer.Compare(_heap[smallestChild], item) < 0 )
        {
            _heap[index] = _heap[smallestChild];
            index = smallestChild;
            firstChild = (index << 1) + 1;
            secondChild = firstChild + 1;
            smallestChild = (secondChild < count && Comparer.Compare(_heap[secondChild], _heap[firstChild]) < 0) ? secondChild : firstChild;
        }
        _heap[index] = item;
    }

    EDIT: Ok, that works, only copy/pasting directly from VS messes up the spacing. And there's still a text overflow issue with long lines of source code.

    Hm... When I click on the "Smilies" button, instead of opening in what I assume was to be a second window, it opens in a second tab, restores, resizes my window, and centres it. Very annoying. (It's not like any of us actually clicks it though, right? Wink)