title: C# Timed function
body: <p>I have the following problem:</p>
  
  <p>I need to run a function search (depth x) that basically searches a decision tree until a certain depth and then returns (or leaves in a class member) a value of type Move.  At the same time I would like to be able to "cancel" the execution of the search if it goes on for too long.</p>
  
  <p>It is also important that I don't have to wait for it if the search does finish faster. I realize this is not a complicated but I am not really familiar with C# concurrency controls.</p>