Click or drag to resize

FileInfoCreate Method

Creates a file.

Namespace: Crestron.SimplSharp.CrestronIO
Assembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntax
C#
public FileStream Create()

Return Value

FileStream
A new file.
Example
using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO;; class Test { public static void Main() { string path = @"c:\MyTest.txt"; FileInfo fi = new FileInfo(path); // Delete the file if it exists. if (fi.Exists) { fi.Delete(); } //Create the file. using (FileStream fs = fi.Create()) { Byte[] info = new UTF8Encoding(true).GetBytes("This is some text for the file."); //Add some information to the file. fs.Write(info, 0, info.Length); } } }

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also