Skip to main content
deleted 1 character in body
Source Link

To eliminate the need for the flag you could do it like this:

var element = _my_repo.SignInToYourAccount.UseAnotherAccount;
foreach (var item in _list)
{
    if (item.GetInnerHtml().Equals(_account_name))
    {
        element = item;
        break;
    }
}
element.Click();

However, your couldcode can be greatly simplified with the Linq extension methods provided in the System.Linqnamespace:

var element = _list.FirstOrDefault(x => x.GetInnerHtml().Equals(_account_name)) ?? _my_repo.SignInToYourAccount.UseAnotherAccount;
element.Click();

To eliminate the need for the flag you could do it like this:

var element = _my_repo.SignInToYourAccount.UseAnotherAccount;
foreach (var item in _list)
{
    if (item.GetInnerHtml().Equals(_account_name))
    {
        element = item;
        break;
    }
}
element.Click();

However, your could can be greatly simplified with the Linq extension methods provided in the System.Linqnamespace:

var element = _list.FirstOrDefault(x => x.GetInnerHtml().Equals(_account_name)) ?? _my_repo.SignInToYourAccount.UseAnotherAccount;
element.Click();

To eliminate the need for the flag you could do it like this:

var element = _my_repo.SignInToYourAccount.UseAnotherAccount;
foreach (var item in _list)
{
    if (item.GetInnerHtml().Equals(_account_name))
    {
        element = item;
        break;
    }
}
element.Click();

However, your code can be greatly simplified with the Linq extension methods provided in the System.Linqnamespace:

var element = _list.FirstOrDefault(x => x.GetInnerHtml().Equals(_account_name)) ?? _my_repo.SignInToYourAccount.UseAnotherAccount;
element.Click();
Notice removed Insufficient justification by 200_success
added 316 characters in body
Source Link

To eliminate the need for the flag you could do it like this:

using System.Linq;

var element = _list_my_repo.FirstOrDefaultSignInToYourAccount.UseAnotherAccount;
foreach (xvar =>item xin _list)
{
    if (item.GetInnerHtml().Equals(_account_name));
if (   {
        element != null)item;
        break;
    }
}
element.Click();
else

However, your could can be greatly simplified with the Linq extension methods provided in the System.Linqnamespace:

var element = _list.FirstOrDefault(x => x.GetInnerHtml().Equals(_account_name)) ?? _my_repo.SignInToYourAccount.UseAnotherAccountUseAnotherAccount;
element.Click();
using System.Linq;

var element = _list.FirstOrDefault(x => x.GetInnerHtml().Equals(_account_name));
if (element != null)
    element.Click();
else
    _my_repo.SignInToYourAccount.UseAnotherAccount.Click();

To eliminate the need for the flag you could do it like this:

var element = _my_repo.SignInToYourAccount.UseAnotherAccount;
foreach (var item in _list)
{
    if (item.GetInnerHtml().Equals(_account_name))
    {
        element = item;
        break;
    }
}
element.Click();

However, your could can be greatly simplified with the Linq extension methods provided in the System.Linqnamespace:

var element = _list.FirstOrDefault(x => x.GetInnerHtml().Equals(_account_name)) ?? _my_repo.SignInToYourAccount.UseAnotherAccount;
element.Click();
Notice added Insufficient justification by 200_success
added 48 characters in body
Source Link
using System.Linq;

var element = _list.FirstOrDefault(x => x.GetInnerHtml().Equals(_account_name));
if (element != null)
    element.Click();
else
    _my_repo.SignInToYourAccount.UseAnotherAccount.Click();
var element = _list.FirstOrDefault(x => x.GetInnerHtml().Equals(_account_name));
if (element != null)
    element.Click();
else
    _my_repo.SignInToYourAccount.UseAnotherAccount.Click();
using System.Linq;

var element = _list.FirstOrDefault(x => x.GetInnerHtml().Equals(_account_name));
if (element != null)
    element.Click();
else
    _my_repo.SignInToYourAccount.UseAnotherAccount.Click();
Source Link
Loading