在IronPython中初始化.Net列表

时间:2017-01-10 16:27:41

标签: ironpython

我正在尝试按如下方式初始化自定义类对象的.net:

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 = ''

稍后在代码中我尝试创建一个EmployeeTree对象列表

EmployeeTreeList = List[EmployeeTree]()

当我尝试创建EmployeeTreeList时,出现以下错误:

  

期望的数组[类型],得到了classobj

有什么想法吗?

0 个答案:

没有答案