Как использовать зависимости с классом, используемым в цикле Parallel.ForEach, одновременно практикуя внедрение зависимо ⇐ C#
Как использовать зависимости с классом, используемым в цикле 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
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Ninject – как выполнить IOC с классом, используемым в цикле Parallel.ForEach
Anonymous » » в форуме C# - 0 Ответы
- 84 Просмотры
-
Последнее сообщение Anonymous
-