偶然间,发现IronPython 1.0支持.Net的范型类,可以讲太强大了。哈!

用以下代码可以测试出来:

 

from System.Collections.Generic import *
l = List[str]()
l.Add('你好,小蟒蛇!')
l.Add('小蟒蛇2号')
l.Add(20) #output : Cannot convert int(20) to String
list(l) #output : [u'\u4f60\u597d\uff0c\u5c0f\u87d2\u86c7\uff01', u'\u5c0f\u87d2\u86c72\u53f7']

 

下面是vs2005里面的IronPython Console的截图: