DataClassesDataContext dcd = new DataClassesDataContext();
var msgs = (from msg in dcd.SK_Messages where msg.MsgStatus == 0 select msg).Take(20);
foreach (var msg1 in msgs)
{
...
}
msgs.GetEnumerator().Reset();
foreach (var msg1 in msgs)
{
...
}
var msgs = (from msg in dcd.SK_Messages where msg.MsgStatus == 0 select msg).Take(20);
foreach (var msg1 in msgs)
{
...
}
msgs.GetEnumerator().Reset();
foreach (var msg1 in msgs)
{
...
}
连续写两个foreach循环,第二个循环的执行次数为零