public static void SerializeInsultData(InsultData insultdata) { serializer.NullValueHandling = NullValueHandling.Ignore; using (StreamWriter sw = new StreamWriter(LocalData.insults)) using (JsonWriter writer = new JsonTextWriter(sw)) { serializer.Serialize(writer, insultdata); } }
public static InsultData DeserialiseInsultData() { InsultData tempInsultData = new InsultData(); serializer.NullValueHandling = NullValueHandling.Ignore; using (StreamReader sr = new StreamReader(LocalData.insults)) using (JsonTextReader jr = new JsonTextReader(sr)) { tempInsultData = serializer.Deserialize<InsultData>(jr); } return tempInsultData; }