本文整理汇总了C#中TextWriter.Close方法的典型用法代码示例。如果您正苦于以下问题:C# TextWriter.Close方法的具体用法?C# TextWriter.Close怎么用?C# TextWriter.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextWriter
的用法示例。
在下文中一共展示了TextWriter.Close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Error
public void Error(String ErrorMessage, bool writeinFile)
{
if (writeinFile == true)/*Write in a file located at C:\Users\Public\Documents\VisualBlock*/{
TextWriter errorInFile = new TextWriter();
errorInFile.Write(ErrorMessage, @"C:\Users\Public\Documents\VisualBlock\Error.txt");
errorInFile.Close();
}
else{
MessageBox.Show(ErrorMessage, "Error");
}
}
示例2: Run
public void Run(string [] args)
{
fs1 = File.CreateText ("type-hierarchy.xml");
fs1.WriteLine ("<android-hierarchy xmlns:android='" + android_ns + "'>");
foreach (var arg in new string [] {"http://developer.android.com/reference/android/view/View.html"}) {
var baseUrl = resolver.ResolveUri (null, arg);
var doc = FetchXmlDocument (baseUrl);
ProcessDocument (baseUrl);
foreach (XmlElement node in doc.SelectNodes ("//div[@id='subclasses-direct' or @id='subclasses-indirect']")) {
foreach (XmlElement link in node.SelectNodes ("div/table[@class='jd-sumtable-expando']/tr/td[@class='jd-linkcol']/a[@href]")) {
if (link.PreviousSibling != null && link.PreviousSibling.Value.Contains ("extends"))
continue; // it is a link to generic type argument.
var durl = resolver.ResolveUri (baseUrl, link.GetAttribute ("href"));
ProcessDocument (durl);
}
}
}
fs1.WriteLine ("</android-hierarchy>");
fs1.Close ();
}
示例3: EndOfItems
void EndOfItems()
{
back.Hide ();
ok.Hide ();
notes.Hide ();
launch.Hide ();
quit.Show ();
checklist.Current().complete = true;
currentItem.Text = "Checklist Complete";
Directory.CreateDirectory ("checklist_logs");
String fname = DateTime.Now.ToString ("yyyy-MM-dd HH-mm") + " checklist.txt";
String path = System.IO.Path.Combine ("checklist_logs", fname);
log = new StreamWriter (path);
log.Write (checklist.ToString ());
log.Close ();
}