Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
List 如何使用Windsor castle在构造函数中传递列表_List_Parameters_Castle Windsor - Fatal编程技术网

List 如何使用Windsor castle在构造函数中传递列表

List 如何使用Windsor castle在构造函数中传递列表,list,parameters,castle-windsor,List,Parameters,Castle Windsor,我有一个IController,它实现了2个ControllerA,ControllerB 假设我有一门课: public class MyComponent { public MyComponent(List<IController> constrollers) { _constrollers = constrollers; } } 公共类MyComponent { 公共MyComponent(列表构造函数) { _控制者=控制者; } } 为了实

我有一个
IController
,它实现了2个
ControllerA
ControllerB

假设我有一门课:

public class MyComponent
{
   public MyComponent(List<IController> constrollers)
   {
      _constrollers = constrollers;
   }
}
公共类MyComponent
{
公共MyComponent(列表构造函数)
{
_控制者=控制者;
}
}
为了实例化这个类,在windsor castle中有一种使用XML的方法

<parameters>
   <constrollers>
      <list>
         <item>controllerA</item>
         <item>controllerB</item>
      </constrollers>
   </info>
</parameters>

控制器
控制员
但是如何使用Fluent以编程方式实现它呢?

container.Register(Component.For())
container.Register(Component.For<MyComponent>()
 .ServiceOverrides(new { controllers = new[] { "controllerA", "controllerB" } }));
.ServiceOverrides(新的{controllers=new[]{“controllerA”、“controllerB”});
顺便说一句,代码无法编译,XML无效。。。