title: Run specific code within a function only once
body: <pre><code>public static void Order_go(string url, string name) 
  {
      // I want to run the line below only once
      var driver = new ChromeDriver(); 
  
      driver.Url = (url);  
      IWebElement b_login1 = driver.FindElement(By.Id("login"));
      b_login1.SendKeys("aa");
      IWebElement b_pass1 = driver.FindElement(By.Name("managerPw"));
      b_pass1.SendKeys("123");
  
      // Execute each time when it is called
  }
  </code></pre>
  
  <p>I tried </p>
  
  <pre><code>Boolean once = true;
  if (once)
  {
      var driver = new ChromeDriver();
      once = false;
  }
  </code></pre>
  
  <p>However, when I call this function, the value of <code>once</code> becomes <code>true</code> again.
  How can I run  this code only once? </p>
  
  <pre><code>var driver = new ChromeDriver();
  </code></pre>