问题
I am trying to initialize a .net of custom class objects as follows:
from System.Collections.Generic import List
class EmployeeTree:
def getEmployeeFirstName(self):
return self.EmployeeFirstName
def setEmployeeFirstName(self, firstName):
self.EmployeeFirstName = firstName.strip()
def getEmployeeLastName(self):
return self.EmployeeLastName
def setEmployeeLastName(self, lastName):
self.EmployeeLastName = lastName.strip()
def getEmployeeNumber(self):
return self.EmployeeNumber
def setEmployeeNumber(self, empNumber):
self.EmployeeNumber = empNumber.strip()
def __init__(self):
self.EmployeeFirstName = ''
self.EmployeeLastName = ''
self.EmployeeNumber = ''
Later in the code I try to create a list of EmployeeTree objects
EmployeeTreeList = List[EmployeeTree]()
When I try to create the EmployeeTreeList I get the following error:
expected Array[Type], got classobj
Any ideas?
来源:https://stackoverflow.com/questions/41573586/initialize-net-list-in-ironpython