C# FileInfo FileInfo
Description
FileInfo FileInfo
Initializes a new instance of the FileInfo
class, which acts as a wrapper for a file path.
Syntax
FileInfo.FileInfo
has the following syntax.
public FileInfo(
string fileName
)
Parameters
FileInfo.FileInfo
has the following parameters.
fileName
- The fully qualified name of the new file, or the relative file name. Do not end the path with the directory separator character.
Example
Initializes a new instance of the FileInfo class, which acts as a wrapper for a file path.
using System;//from w w w . j a v a2 s .c om
using System.IO;
public class DirectoryTest
{
public static void Main()
{
FileInfo fi = new FileInfo("temp.txt");
Console.WriteLine(fi.Name);
}
}
The code above generates the following result.