This is my code :
public class PuntoMappa
{
string Lat;
string Lng;
public PuntoMappa(string Lat, string Lng)
{
this.Lat = Lat;
this.Lng = Lng;
}
}
PuntiCategoriaMappa.Add("1111", new PuntoMappa("1", "2"));
PuntiCategoriaMappa.Add("2222", new PuntoMappa("3", "4"));
PuntiCategoriaMappa.Add("3333", new PuntoMappa("5", "6"));
var jsonSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "PuntiCategoriaMappa", "PuntiCategoriaMappa = " + jsonSerializer.Serialize(PuntiCategoriaMappa) + ";", true);
but the serialization is :
PuntiCategoriaMappa = {"1111":{},"2222":{},"3333":{}};
Well, I lost the serialization of PuntoMappa objects.
How can I correctly do this?