I am busy creating a VisibilityTagHelper that will set the visibility of a div. The TagHelper is really simple:[HtmlTargetElement(div)]    public class VisibilityTagHelper : TagHelper    {        // default to true otherwise all existing target elements will not be shown, because bool's default to false        public bool IsVisible { get; set; } = true;        public Predicate<bool> IsVisibleExp { get; set; }        public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)        {            var s = IsVisibleExp.Invoke(true);            if (!IsVisible)                output.SuppressOutput();            return base.ProcessAsync(context, output);        }    }I want to pass in an expression that will validate an condition that is what this line is for: public Predicate<bool> IsVisibleExp { get; set; }Then in the Razor view I can do the following:<div is-visible-exp=_ => 12 > 14>    This should only be visible if you're logged in</div>Is there a better way of doing it? I am not particularly fond of the predicate but not sure if there is a better way of doing it.I guess I can use the IsVisible like this:@{    var isVisible = 12 > 14;}<div is-visible=@isVisible>    This should only be visible if you're logged in</div>but then I will need to create the condition in advance.
TagHelper with expression
c#;asp.net mvc;asp.net core