title: C# Backing Up And Restoring Clipboard
body: <p>I have a program that uses clipboard but I want to restore the clipboard to its former state after I am done with it.</p>
  
  <p>This is my code : </p>
  
  <pre><code>IDataObject temp = Clipboard.GetDataObject();
  
  //Some stuff that change Cliboard here
  Clipboard.SetText("Hello");
  //Some stuff that change Cliboard here
  
  Clipboard.SetDataObject(temp);
  </code></pre>
  
  <p>But it if I copy a text, and run this code, I get nothing on notepad.</p>
  
  <p>NOTE : I can't use Clipboard.Contains because I want to preserve the Clipboard EXACLY how it was before, even if the user copied a file.</p>