CodeBox.CodeLexer.Token.CompareTo C# (CSharp) Method

CompareTo() public method

public CompareTo ( object obj ) : int
obj object
return int
        public int CompareTo(object obj)
        {
            // mainly used in sorting TokenList.Tokens (see Controller.TextChanged())
            // will assume obj is always of type Token (as it should be)
            var other = obj as Token;

            if (Line > other.Line) return 1;
            if (Line < other.Line) return -1;

            if (Position > other.Position) return 1;
            if (Position < other.Position) return -1;

            return 0;
        }