title: C# file output (.exe) can run code even without the program running
body: <p>Okay, I admit the title is somewhat vague and I don't know how to describe it in title. Even the tags I'm not sure what to put for this question. </p>
  
  <p>So, I have an encryption &amp; decryption program (in c#), I can encrypt it to become .exe file. Now, I want to decrypt it back without running the program. I just wanted to run the .exe file and it will decrypt itself (using my own algorithm I had already).</p>
  
  <p>What I have in concept right now is that I need to embed my decryption code when it was encrypted. Is there any way around it? Google() can't really helped me since I don't know the terms about this. Maybe anyone here can help me?</p>
  
  <p>General Idea:</p>
  
  <p>my encryption function: </p>
  
  <pre><code>Encrypt(string input, string output, string key)
  {
      .....after all encryption happens....
      &lt;produce output which is .exe&gt;
      &lt;embed the decryption function, which will run when .exe is launched&gt;
  }
  </code></pre>
  
  <p>my decryption function (the one need to be embeded while encrypting files): </p>
  
  <pre><code>Decrypt(string input, string output, string key)
  </code></pre>
  
  <p>If I make myself confusing, please just remind me about it. I will try to make it more comprehensible. Thank you very much.</p>