The CNCrLib.IO and CNCrLib.Core orCNCrLib.Core.Intf namespaces provide several interfaces that allow for various actions, such as reading and writing, to be performed on files, directories, and streams.
To do this... |
See the example in this topic... |
---|---|
Create a text file |
_File.CreateText method _FileInfo.CreateText method _File.Create method _FileInfo.Create method |
Write to a text file |
|
Read from a text file |
|
Append text to a file |
How to: Open and Append to a Log File _File.AppendText method _FileInfo.AppendText method |
Rename or move a file |
_File.Move method _FileInfo.MoveTo method |
Delete a file |
_File.Delete method _FileInfo.Delete method |
Copy a file |
_File.Copy method _FileInfo.CopyTo method |
Get the size of a file |
_FileInfo.Length property |
Get the attributes of a file |
_File.GetAttributes method |
Set the attributes of a file |
_File.SetAttributes method |
Determine whether a file exists |
_File.Exists method |
Read from a binary file |
|
Write to a binary file |
|
Retrieve a file name extension |
_Path.GetExtension method |
Retrieve the fully qualified path of a file |
|
Retrieve the file name and extension from a path |
_Path.GetFileName method |
Change the extension of a file |
_Path.ChangeExtension method |
To do this... |
See the example in this topic... |
---|---|
Access a file in a special folder such as My Documents |
|
Create a directory |
_Directory.CreateDirectory method _FileInfo.Directory property |
Create a subdirectory |
_DirectoryInfo.CreateSubdirectory method |
Rename or move a directory |
_Directory.Move method _DirectoryInfo.MoveTo method |
Copy a directory |
How to: Copy Directories |
Delete a directory |
_Directory.Delete method _DirectoryInfo.Delete method |
See the files and subdirectories in a directory |
|
Find the size of a directory |
CNClrLib.Core._Directory or CNClrLib.Core.Intf._Directory Interface |
Determine whether a directory exists |
_Directory.Exists method |