# HG changeset patch # User cin # Date 2017-09-20 22:06:32 # Node ID 3eaa9372c75403ba69b0a023f114fc53176ff8ee # Parent 5f7a3e1d32b998a703539963ed4ed369b925bc6b Added SerializationHelpers.SerializeToFile method diff --git a/Implab/Xml/SerializationHelpers.cs b/Implab/Xml/SerializationHelpers.cs --- a/Implab/Xml/SerializationHelpers.cs +++ b/Implab/Xml/SerializationHelpers.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -32,6 +33,11 @@ namespace Implab.Xml { return doc; } + public static void SerializeToFile(string file, T obj) { + using (var writer = File.CreateText(file)) + SerializersPool.Instance.Serialize(writer, obj); + } + public static T DeserializeFromString(string data) { return SerializersPool.Instance.DeserializeFromString(data); }