当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - How can I set up Unity 3 to work in a console application?

问题描述:

I would like to get some experience using Unity 3 so I set up a console application and downloaded Unity from nuGet.

However I didn't find any examples on how I can start Unity? Do I need to add some code to my main method to make a Unity container or is it normal to put that code into another file and call that?

Note that I did find the "Unity hands-on labs" but these look far too complicated for a starter tutorial. I would really like to find some starter example coded in C# if anyone has any links bookmared that would be a great help.

网友答案:

http://msdn.microsoft.com/en-us/library/dn178463(v=pandp.30).aspx

Basically, yes, you have to initialize Unity first. Just put this in the beginning of your Main method:

var container = new UnityContainer();
container.RegisterType<IYourType, YourType>();
分享给朋友:
您可能感兴趣的文章:
随机阅读: