الجمعة، 27 ديسمبر 2013

how to get a list from C# code into a list in python

I have a C# DLL that I am calling in python and one of its methods returns what should be like a list

this code works

data =[0,1]ch=['VCC_CORE0','VCCSFR']data[0],data[1] = myDaqControl.SpyMulti(ch)

but I am trying to make it dynamic don't want to add the list arguments at the start because in this example I have ch = 2 variables but next time it can be 5 or 10

so typing data[0],data[1]..... doesn't make sense

doing data = myDaqControl.SpyMulti(ch) doesn't work and I get from interpreter is:

i found out the the C# code should be returning an Array

additional code priore to what i mentioned

import clrimport sysimport timeitimport timeChannel ='Iin_P1'ConfigFile='c:\NiDaq_spy.xml'start_time = time.time()sys.path.append(r'C:\daq\Bin')clr.AddReference('DaqBase.Factory')from Daq import DaqControlFactoryfrom Daq import IDaqControlmyDaqControl = DaqControlFactory.GetDaqControl("NiDaq")

View the original article here

ليست هناك تعليقات:

إرسال تعليق