Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Json serialization if IEnumerables with JavaScriptSerializer

$
0
0

I just hit a (to me) surprising behaviour of the JavaScriptSerializer, in that it serializes any IEnumberable as an array. I quite often define things like

Interface IFoo : IEnumerable<Bar> {
  int MyFoo {get;}
  string Wibble {get;}
  DateTime Wobble {get;}
}

I was quite surprised this got serialized as a JS array of Bars. Is this considered reasonable behaviour? Should it change? What do others think about this?


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>