There are multiple ways you can create files in C# and FileInfo class is one of them. The FileInfo class in the .NET Framework class library provides static methods for creating, reading, copying, moving, and deleting files using the FileStream objects.
The FileInfo class is defined in the System.IO namespace. You must import this namespace before using the class.
A FileInfo object is created using the default constructor that takes a string as a file name with a full path.
Here is a complete sample that not only creates a file but also reads a file attributes such as file creation time, its size, last updated, last accessed, and last write times.