title: Is it possible to make an anonymous class inherit another class?
body: <p>This is a long shot, but I have a funny coding situation where I want the ability to create anonymous classes on the fly, yet be able to pass them as a parameter to a method that is expecting an interface or subclass.  In other words, I'd like to be able to do something like this:</p>
  
  <pre><code>public class MyBase { ... }
  
  public void Foo(MyBase something)
  {
    ...
  }
  
  ...
  var q = db.SomeTable.Select(t =&gt;
          new : MyBase // yeah, I know I can't do this...
          {
            t.Field1,
            t.Field2,
          });
  foreach (var item in q)
    Foo(item);
  </code></pre>
  
  <p>Is there any way to do this other than using a named class?</p>