I have this piece of code.
I want to convert this into lambda expression. How to reach this
string[] MyString= ConfigurationManager.AppSettings["MyStringData"].Split(',');
foreach (string res in MyString)
{
if (res != "MyName")
{
btnshowname.Visible = false;
}
else if (res == "MyName")
{
btnshowname.Visible = true;
break;
}
}
Tell me the lambda expression please and how to achieve this
btnshowname.Visible = MyString.Any(s => s == "MyName");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With