C# Class Python.Runtime.PyInt

Represents a Python integer object. See the documentation at http://www.python.org/doc/current/api/intObjects.html for details.
Inheritance: PyNumber
Mostrar archivo Open project: fkarb/pythonnet Class Usage Examples

Public Methods

Method Description
AsInt ( PyObject value ) : PyInt

AsInt Method

Convert a Python object to a Python int if possible, raising a PythonException if the conversion is not possible. This is equivalent to the Python expression "int(object)".

IsIntType ( PyObject value ) : bool

IsIntType Method

Returns true if the given object is a Python int.

PyInt ( IntPtr ptr ) : System

PyInt Constructor

Creates a new PyInt from an existing object reference. Note that the instance assumes ownership of the object reference. The object reference is not checked for type-correctness.

PyInt ( PyObject o ) : System

PyInt Constructor

Copy constructor - obtain a PyInt from a generic PyObject. An ArgumentException will be thrown if the given object is not a Python int object.

PyInt ( byte value ) : System

PyInt Constructor

Creates a new Python int from a byte value.

PyInt ( int value ) : System

PyInt Constructor

Creates a new Python int from an int32 value.

PyInt ( long value ) : System

PyInt Constructor

Creates a new Python int from an int64 value.

PyInt ( short value ) : System

PyInt Constructor

Creates a new Python int from an int16 value.

PyInt ( string value ) : System

PyInt Constructor

Creates a new Python int from a string value.

ToInt16 ( ) : short

ToInt16 Method

Return the value of the Python int object as an int16.

ToInt32 ( ) : int

ToInt32 Method

Return the value of the Python int object as an int32.

ToInt64 ( ) : long

ToInt64 Method

Return the value of the Python int object as an int64.

Private Methods

Method Description
PyInt ( sbyte value ) : System
PyInt ( uint value ) : System
PyInt ( ulong value ) : System
PyInt ( ushort value ) : System

Method Details

AsInt() public static method

AsInt Method
Convert a Python object to a Python int if possible, raising a PythonException if the conversion is not possible. This is equivalent to the Python expression "int(object)".
public static AsInt ( PyObject value ) : PyInt
value PyObject
return PyInt

IsIntType() public static method

IsIntType Method
Returns true if the given object is a Python int.
public static IsIntType ( PyObject value ) : bool
value PyObject
return bool

PyInt() public method

PyInt Constructor
Creates a new PyInt from an existing object reference. Note that the instance assumes ownership of the object reference. The object reference is not checked for type-correctness.
public PyInt ( IntPtr ptr ) : System
ptr System.IntPtr
return System

PyInt() public method

PyInt Constructor
Copy constructor - obtain a PyInt from a generic PyObject. An ArgumentException will be thrown if the given object is not a Python int object.
public PyInt ( PyObject o ) : System
o PyObject
return System

PyInt() public method

PyInt Constructor
Creates a new Python int from a byte value.
public PyInt ( byte value ) : System
value byte
return System

PyInt() public method

PyInt Constructor
Creates a new Python int from an int32 value.
public PyInt ( int value ) : System
value int
return System

PyInt() public method

PyInt Constructor
Creates a new Python int from an int64 value.
public PyInt ( long value ) : System
value long
return System

PyInt() public method

PyInt Constructor
Creates a new Python int from an int16 value.
public PyInt ( short value ) : System
value short
return System

PyInt() public method

PyInt Constructor
Creates a new Python int from a string value.
public PyInt ( string value ) : System
value string
return System

ToInt16() public method

ToInt16 Method
Return the value of the Python int object as an int16.
public ToInt16 ( ) : short
return short

ToInt32() public method

ToInt32 Method
Return the value of the Python int object as an int32.
public ToInt32 ( ) : int
return int

ToInt64() public method

ToInt64 Method
Return the value of the Python int object as an int64.
public ToInt64 ( ) : long
return long