调用需要一个参数

public static void WaitUntilElementVisible(Action<string> preAction = null) 
{
      preAction?.Invoke();
}

static void Main(string[] args) 
{
    WaitUntilElementVisible((str) => PanelHandler("in"));
}

public static void PanelHandler(string className) 
{
   // do something
}

I want to execute PanelHandler("in") if its not null inside the WaitUntilElementVisible() method. However the Invoke() expects a string. But the strange thing is that I'm already giving it a string when I do WaitUntilElementVisible(() => PanelHandler("in")); how can I make Invoke use the string which I pass via lambda?

I want to call WaitUntilElementVisible() in such a way that WaitUntilElementVisible() will invoke PanelHandler with "in".