Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在Python中使用System.Collections.Generic.List`1[System.Byte]_C#_Python_.net_Ironpython_Python.net - Fatal编程技术网

C# 在Python中使用System.Collections.Generic.List`1[System.Byte]

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

我有一个Python脚本,它从.NET应用程序接收数据。如何在脚本中使用“System.Collections.Generic.List`1[System.Byte]”类型的传入缓冲区

该脚本的功能是查找并替换字符串标记,将缓冲区重新组装回System.Collections.Generic.List`1[System.Byte],然后将缓冲区返回到.NET服务器

我对Python非常陌生。这就是我到目前为止所做的:

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]