2014-10-24 1 views

답변

1

는만큼 등록 된 유형이 그들에게을 적용 이름이 같이

container.RegisterType<IBar, ActualBar>("ActualBar"); 
container.RegsiterType<IBar, YetAnotherBar>("YetAnotherBar"); 

그리고 주어진 적절한 public 생성자는 언급과 같이

public Foo(IBar[] bars) 
{ 
} 

유니티는 모든 해결의 처리됩니다 등록 된 인스턴스를 생성자에 그대로 둡니다.

Foo foo = container.Resolve<Foo>(); 
+0

감사합니다. 작업 유형에 이름을 추가하십시오. – Rhabarbertoast

+1

왜 이름이 필요합니까? 나는 그것이 이름 없이도 작동하기를 기대한다. – disklosr

관련 문제