title: DataContractJsonSerializer and Enums
body: <p>When I serialize a enum value using DataContractJsonSerializer, it serializes the numerical value of the enum, not the string name. </p>
  
  <p>IE:</p>
  
  <pre><code>enum foo
  {
     bar,
     baz
  }
  </code></pre>
  
  <p>Serializing a value of foo.bar returns "0", not "bar".</p>
  
  <p>I'd prefer it the other way around, is there a way to override this?</p>
  
  <p>Edit: </p>
  
  <p>Because I didn't want to change the serializer, I used a simple workaround hack.</p>
  
  <p>I exposed a property in the class to serialize that calls ToString on the value, ie:</p>
  
  <pre><code>// Old
  [DataMember]
  public EnumType Foo
  {
      get { return _foo; }
      set { _foo = value; }
  }
  
  // New, I still kept the EnumType but I only serialize the string version
  
  public EnumType Foo
  {
      get { return _foo; }
      set { _foo = value; }
  }
  
  [DataMember]
  public string FooType
  {
      get { return _foo.ToString(); }
      private set {}
  }
  </code></pre>