title: Using XmlSerializer on a class with anonymous methods
body: <p>I want to serialize a class which uses an anonymous function in its implementation.  The compiler is generating an inner class to implement the anonymous function.  The serializer fails with the error: "MyClass+&lt;>c__DisplayClass2 is inaccessible due to its protection level. Only public types can be processed."</p>
  
  <pre><code>public class MyClass {
      public doIt() {
          int objective = 0;
          return List&lt;int&gt; () { 1 }.Any(i =&gt; i == objective);
      }
  }
  
  new XmlSerializer(typeof(MyClass)).Serialize(writer, myClass);
  </code></pre>
  
  <p>How do I serialize this class?  Thanks.</p>