title: Use [STAThread] in a console program in C#
body: <p>I have written code for a C# console application. It copies a clipboard value to a file, and it runs without any error.</p>
  
  <p>Now I want to use it in another C# project with other code. </p>
  
  <p>I use  <code>[STAThread]</code> after <code>class{}</code>, but it give me an error:</p>
  
  <blockquote>
    <p>:: Attribute 'STAThread' is not valid on this declaration type. It is only valid on 'method' declarations.    </p>
  </blockquote>
  
  <p>What can I do?</p>