title: How to serialize an object in C# and prevent tampering?
body: <p>I have a C# class as follows:</p>
  
  <pre><code>public class TestObj
  {
      private int intval;
      private string stringval;
      private int[] intarray;
      private string[] stringarray;
  
      //... public properties not shown here
  }
  </code></pre>
  
  <p>I would like to serialize an instance of this class into a string.</p>
  
  <p>In addition:</p>
  
  <p>I will be appending this string as a QueryString param to a URL. So I would like to take some effort to ensure that the string cannot be tampered with easily.</p>
  
  <p>Also, I would like the serialization method to be efficient so the size of the string is minmal.</p>
  
  <p>Any suggestions of specific .NET Framework classes/methods I should use?</p>