title: why does c# JavaScriptSerializer.Serialize return empty square brackets
body: <p>Why does the following code return "[ ]" when it should return "{"id":1999, "title":"hithere"}</p>
  
  <pre><code>    JavaScriptSerializer serializer = new JavaScriptSerializer();
      StringBuilder sbJsonResults = new StringBuilder();
      var result = serializer.Serialize(new dg(1999, "hithere"));
  
      context.Response.Clear();
      context.Response.ContentType = "application/json; charset=utf-8";
      context.Response.Cache.SetExpires(DateTime.MinValue);
      context.Response.Write(result);
  </code></pre>
  
  <p>P.S. the dg class looks like this: </p>
  
  <pre><code>    public class dg : ScheduleObserver, ILibrary, IEnumerable {
          public int id;
          public string title;
          private List&lt;d&gt; dList;
          ...many getters and setters and some logic functions...
      }
  
      public abstract class ScheduleObserver{
          public abstract void update();
      }
  
      public interface ILibrary {
          List&lt;PD&gt; getPDs();
          void setPDs(List&lt;PD&gt; newPDs);
          int getCurrentIndex();
          void addPD(PD pD);
          PD getPD(int index);
      }
  </code></pre>
  
  <p>Many thanks.</p>
  
  <p>THANKS - ANSWERED SUCCESSFULLY - it was the IEnumerable that was the source of my woes.  To solve it, dg no longer extends IEnumerable and all foreach (dg...) loops have been converted back into for(int i = 0...) loops.    </p>
  
  <p>THANKS VERY, VERY MUCH! JAMES got why its empty, Parv got why had square brackets.  Would mark both as answer but can only mark one.</p>