private toJson ( Object obj, Type theClass ) : String | ||
obj | Object | |
theClass | Type | |
return | String |
private String toJson(Object obj, Type theClass)
{
DataContractJsonSerializer ser = new DataContractJsonSerializer(theClass);
MemoryStream stream = new MemoryStream();
ser.WriteObject(stream, obj);
stream.Position = 0;
StreamReader streamreader = new StreamReader(stream);
return streamreader.ReadToEnd();
}