Initialize .Net List in IronPython

吃可爱长大的小学妹 提交于 2020-01-04 01:54:04

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!