Как использовать зависимости с классом, используемым в цикле Parallel.ForEach, одновременно практикуя внедрение зависимо ⇐ C#
-
Anonymous
Как использовать зависимости с классом, используемым в цикле Parallel.ForEach, одновременно практикуя внедрение зависимо
I have some code that looks like below. I'm new to Inversion of Control and Ninject and don't know how to inject IOtherClass into SomeService so that the Parallel.ForEach works. My only other guess is to move the Parallel.ForEach into the DoWork method?
Thanks for any help.
public class SomeService { Parallel.Foreach(items, item => new OtherClass.DoWork(item); } public class OtherClass:IOtherClass { public void DoWork() {...} }
Источник: https://stackoverflow.com/questions/168 ... while-prac
I have some code that looks like below. I'm new to Inversion of Control and Ninject and don't know how to inject IOtherClass into SomeService so that the Parallel.ForEach works. My only other guess is to move the Parallel.ForEach into the DoWork method?
Thanks for any help.
public class SomeService { Parallel.Foreach(items, item => new OtherClass.DoWork(item); } public class OtherClass:IOtherClass { public void DoWork() {...} }
Источник: https://stackoverflow.com/questions/168 ... while-prac
Мобильная версия