foreach (Process newprcs in oPrcs)
{
newprocid = (UInt32)newprcs.Id;
if (!oNewProcs.Contains(newprocid)) //checking process id contain or not
{
oNewProcs.Add(newprocid);
// MessageBox.Show(newprocid.ToString());
uIdOfProcess = newprocid;
//MessageBox.Show(uIdOfProcess.ToString(),"ProcessId");
CInjector.HookingAPI(uIdOfProcess, "HookPrintAPIs.dll");
}
}
foreach (Process newprcs in oPrcs) { newprocid = (UInt32)newprcs.Id; if (!oNewProcs.Contains(newprocid)) //checking process id
Share
It depends on the type of
oPrcs. If it’s aProcess[]then it would be:Otherwise, if the type of
oPrcsimplementsIEnumerable<Process>(which it doesn’t have to, admittedly – but it normally would) you’d get:Having said all that, I usually wouldn’t convert a
foreachloop into aforloop…