Hi all,
can anyone tell me how can i increase foreach performance using dot net framework 3.5
is there any performance improvement technique kindly suggest me if any
Hi all,
can anyone tell me how can i increase foreach performance using dot net framework 3.5
is there any performance improvement technique kindly suggest me if any
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satya KarkiRank #78 · 24.6K reputationPosted Aug 17, 2021, 7:32 AM EDT
Rijwan AnsariRank #82 · 24.2K reputationPosted Aug 17, 2021, 8:51 AM EDT
siva nathanRank #1,695 · 899 reputationPosted Aug 17, 2021, 7:42 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 17, 2021, 8:17 AM EDT
Satya KarkiRank #78 · 24.6K reputationPosted Aug 17, 2021, 8:47 AM EDT
implement this class for parallel foreach
public class Parallel { public static void ForEach(IEnumerable items, Action action) { if (items == null) throw new ArgumentNullException("enumerable"); if (action == null) throw new ArgumentNullException("action"); var resetEvents = new List(); foreach (var item in items) { var evt = new ManualResetEvent(false); ThreadPool.QueueUserWorkItem((i) => { action((T)i); evt.Set(); }, item); resetEvents.Add(evt); } foreach (var re in resetEvents) re.WaitOne(); } }