C# 在Python中使用System.Collections.Generic.List`1[System.Byte]
我有一个Python脚本,它从.NET应用程序接收数据。如何在脚本中使用“System.Collections.Generic.List`1[System.Byte]”类型的传入缓冲区 该脚本的功能是查找并替换字符串标记,将缓冲区重新组装回System.Collections.Generic.List`1[System.Byte],然后将缓冲区返回到.NET服务器 我对Python非常陌生。这就是我到目前为止所做的:C# 在Python中使用System.Collections.Generic.List`1[System.Byte],c#,python,.net,ironpython,python.net,C#,Python,.net,Ironpython,Python.net,我有一个Python脚本,它从.NET应用程序接收数据。如何在脚本中使用“System.Collections.Generic.List`1[System.Byte]”类型的传入缓冲区 该脚本的功能是查找并替换字符串标记,将缓冲区重新组装回System.Collections.Generic.List`1[System.Byte],然后将缓冲区返回到.NET服务器 我对Python非常陌生。这就是我到目前为止所做的: import array import clr from System.Col
import array
import clr
from System.Collections.Generic import *
def SetRecvBuffer(buffer):
li = List[byte](buffer)
hookme.Debug(li)
for x in li:
hookme.Debug(x)
任何帮助都将不胜感激。谢谢 问题在于Python端的C#列表
初始化忽略了括号中的项目,这看起来像一个bug,现在使用List.Add()
:
import clr
clr.AddReference("System.Collections")
from System.Collections.Generic import List
from System import Int32
li = List[Int32](range(3))
list(li) #returns []
li.Add(5)
list(li) #returns [5]