How to inject a generic IList of objects using Unity 2 XML config?

Actually you can try to apply an alias instead of inheriting to a new type.

Actually you can try to apply an alias instead of inheriting to a new type. Using ActivityList=System.Collections.Generic. List; //.... after some declarations var activityList = new ActivityList(); I've been reading about Unity configuration file.

I know you can create alias, but I'm not sure how to specify generics BTW This article has an explanation an options to use generics ;-) dotnetslackers.com/articles/net/A-First-... I hope this helps EDIT: After taking some time trying to use it, here is my answer: List Suppose you want to use resolve from "IList" to "List". 1 First you will have to prepare your configuration file, in this case it's using signed references to IList as well as List. 2 Use the container to resolve the dependency ;-) using System; using System.Collections.

Generic; using System. Linq; using System. Text; using Microsoft.Practices.

Unity; using Microsoft.Practices.Unity. Configuration; namespace UnityTerminal { class Program { static void Main(string args) { var container = new UnityContainer(); container. LoadConfiguration(); { var concreteStringList = container.

Resolve>(); concreteStringList. Add(" } { var concreteStringList = container. Resolve>(); Console.

WriteLine("{0}", concreteStringList0); } Console.ReadKey(); } } } That should be enough, I hope this works ;-) Best regards, Herber.

What I would do is create a type ActivityList that derives from IList. Class ActivityList : IList { /* */ } This kind of stuff inside a config file: System.Collections.Generic. IList`1MyProject.

IActivity, MyProject, mscorlib is hard to understand and maintain.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions