System.Int32.CompareTo C# (CSharp) Method

CompareTo() public method

public CompareTo ( int value ) : int
value int
return int
        public int CompareTo(int value)
        {
            if (_value < value) return -1;
            else if (_value > value) return 1;
            return 0;
        }

Usage Example

示例#1
0
    static int CompareTo(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <int>(L, 2))
            {
                System.Int32 obj  = (System.Int32)ToLua.CheckObject(L, 1, typeof(System.Int32));
                int          arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                int          o    = obj.CompareTo(arg0);
                LuaDLL.lua_pushinteger(L, o);
                ToLua.SetBack(L, 1, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <object>(L, 2))
            {
                System.Int32 obj  = (System.Int32)ToLua.CheckObject(L, 1, typeof(System.Int32));
                object       arg0 = ToLua.ToVarObject(L, 2);
                int          o    = obj.CompareTo(arg0);
                LuaDLL.lua_pushinteger(L, o);
                ToLua.SetBack(L, 1, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.Int32.CompareTo"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
All Usage Examples Of System.Int32::CompareTo