示例#1
0
        public async Task WriteData(TType data)
        {
            try
            {
                var serializer = new XmlSerializer(typeof(TType));
                var builder    = new StringBuilder();

                using (TextWriter writer = new StringWriter(builder))
                {
                    serializer.Serialize(writer, data);
                }

                await _fileAccessor.WriteFile(_fileUri, builder.ToString());
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }