在 Python 中获取 C# Int64
Getting C# Int64 in Python
我必须在 Python 中获取一个 Int64 对象。我的代码如下所示:
from System import Int64
l = Int64.Parse('123')
print(l, type(l))
但是 returns: 123 <class 'int'>
当我对 DateTime c# 对象执行相同操作时,它返回正确的类型:<class 'System.DateTime'>
那么为什么 Python 将 Int64 C# 对象转换回它自己的 int class?
我正好需要这种类型,因为我要将它发送到外部程序,否则会失败。
非常感谢。
想出了一个办法,但是很切腹:
Int64.__new__(Int64, value)
我必须在 Python 中获取一个 Int64 对象。我的代码如下所示:
from System import Int64
l = Int64.Parse('123')
print(l, type(l))
但是 returns: 123 <class 'int'>
当我对 DateTime c# 对象执行相同操作时,它返回正确的类型:<class 'System.DateTime'>
那么为什么 Python 将 Int64 C# 对象转换回它自己的 int class?
我正好需要这种类型,因为我要将它发送到外部程序,否则会失败。
非常感谢。
想出了一个办法,但是很切腹:
Int64.__new__(Int64, value)