WP追加字符串到文件

#if DEBUG
                const string logfile = "demo.log";
                try
                {
                    using (var sw = new System.IO.StreamWriter(System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication().OpenFile(logfile, System.IO.FileMode.Append, System.IO.FileAccess.Write, System.IO.FileShare.Read)))
                    {
                        sw.WriteLine(string.Format("{0} [Demo] {1}", DateTime.Now, "a message"));
                    }
                }
                catch (Exception ex) { Debug.WriteLine("Save {0} ERROR!! {1}", logfile, ex); }
#endif

 

posted @ 2015-05-20 15:49  Bob-wei  阅读(286)  评论(0编辑  收藏  举报