页面.aspx:
<a href="#" <%= ToggleUiVisibility(new List<bool>() { true, true, false }) %> >
link
</a>
C#:
public string ToggleUiVisibility(List<bool> conditions)
{
return conditions.Any(x=>!x) ? "style=\"display:none;\"" : string.Empty;
}
我想知道是否可以做类似(伪代码)的事情
ToggleUiVisibility(true, true, argsN);
public string ToggleUiVisibility(args)
{
// make sure each argument is a bool and trigger the same
// functionality as above
}