Windows下学习.Net,大家一般都会选用VS,我当然也不例外。不过,今天试用版的Visual Studio 2010到期了。但要坚持学习只能另想办法了。突然脑海中闪过了IronPython,我一年前因为Python而认识到的东西。IronPython就是面向.Net环境的Python。今天让我们就一起体验下如何不用VS学习.Net吧!
 
学习内容:Thread
1 无传递参数的Thread
 
相应的IronPython实现:
from System.Threading import Thread,ThreadStart
def ThreadProc():
         for i in range(0, 10): print i
thread = Thread(ThreadStart(ThreadProc))
thread.Start()
 
2 带参数传递的Thread
 
相应的IronPython实现:
from System.Threading import Thread,ParamterizedThreadStart
def DoWork(data):
         print data
thread = Thread(ParamterizedThreadStart(DoWork))
thread.Start(“Parameter”)
 
较之C#的代码,IronPython的代码简洁了很多,有点四两拨千斤的作用。如果你也正在学习.Net,但又苦于没有VS,不妨也来体验下IronPython吧!