FileInfoAppendText Method |
Namespace: Crestron.SimplSharp.CrestronIOAssembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntax
Example
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;;
class Test
{
public static void Main()
{
FileInfo fi = new FileInfo(@"\user\MyTest.txt");
// This text is added only once to the file.
if (!fi.Exists)
{
//Create a file to write to.
using (StreamWriter sw = fi.CreateText())
{
sw.WriteLine("Hello");
sw.WriteLine("And");
sw.WriteLine("Welcome");
}
}
// This text will always be added, making the file longer over time
// if it is not deleted.
using (StreamWriter sw = fi.AppendText())
{
sw.WriteLine("This");
sw.WriteLine("is Extra");
sw.WriteLine("Text");
}
}
}
Version Information
.NET
Supported in: 6.0
.NET Compact Framework
Supported in: 3.5
See Also