All returns a Boolean result so you could use it in an if statement.
if (Test.All(i => (i % 2) == 0) || Test.All(i => (i % 2) > 0))
{
//all odd or even so do stuff
}
else
{
//mixed so do stuff
}
All returns a Boolean result so you could use it in an if statement.
if (Test.All(i => (i % 2) == 0) || Test.All(i => (i % 2) > 0))
{
//all odd or even so do stuff
}
else
{
//mixed so do stuff
}
Hi
I wanna close all of the open forms but their BorderStyle property is None so the below code don't work for this issue. which code should I use instead?!
foreach (Form f in Application.OpenForms)
{
if (f.Name != "frmMain")
{
f.Close();
break;
}
}
امیدوارم همیشه بروز باشید I hope always be up2date
foreach (var i=Application.OpenForms.Count-1;i>=0;i--)
{
var f= Application.OpenForms[i];
if (f.Name != "frmMain")
{
f.Close();
break;
}
}
Muthukrishnan Ramasamy
net4.rmkrishnan.net
Use only what you need, Reduce global warming
امیدوارم همیشه بروز باشید I hope always be up2date
Missed to change foreach to for
for(var i=Application.OpenForms.Count-1;i>=0;i--)
{
var f= Application.OpenForms[i];
if (f.Name != "frmMain")
{
f.Close();
break;
}
}
Muthukrishnan Ramasamy
net4.rmkrishnan.net
Use only what you need, Reduce global warming
امیدوارم همیشه بروز باشید I hope always be up2date
for (var i = Application.OpenForms.Count - 1; i >= 0;i-- )
{
var f = Application.OpenForms[i];
if (f.Name != "frmMain" && f.FormBorderStyle == System.Windows.Forms.FormBorderStyle.None)
{
f.Close();
//break;
}
}
Muthukrishnan Ramasamy
net4.rmkrishnan.net
Use only what you need, Reduce global warming