title: Is there a way in C# to call a method just once like in the jQuery "one" method?
body: <p>I wish to know if there is a way to execute code in C# just once, like "one" in jquery:</p>
  
  <p>$("#foo").one("click", function() {
    alert("This will be displayed only once.");
  });</p>
  
  <p>What I would like to do is the following:</p>
  
  <pre><code>public void foo(){
    Console.Write("hello");
  }
  </code></pre>
  
  <p>then</p>
  
  <pre><code>foo();
  foo();
  foo();
  </code></pre>
  
  <p>and the output result must be</p>
  
  <pre><code>hello
  </code></pre>
  
  <p>I´m looking for a library and not just using flags attributes.</p>