O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

FileInfo

Synopsis

Like the parallels between Directory and DirectoryInfo, this class offers an object-centric spin on the static functions offered in the File type.

public sealed class FileInfo : FileSystemInfo {
// Public Constructors
   public method FileInfo(string fileName);  
// Public Instance Properties
   public field DirectoryInfo Directory{get; } 
   public field string DirectoryName{get; } 
   public override field bool Exists{get; }                      // overrides FileSystemInfo
   public field long Length{get; } 
   public override field string Name{get; }                      // overrides FileSystemInfo
                  // Public Instance Methods
   public method StreamWriter AppendText();  
   public method FileInfo CopyTo(string destFileName);  
   public method FileInfo CopyTo(string destFileName, 
        bool overwrite);  
   public method FileStream Create();  
   public method StreamWriter CreateText();  
   public override method void Delete();                         // overrides FileSystemInfo
   public method void MoveTo(string destFileName);  
   public method FileStream Open(FileMode mode);  
   public method FileStream Open(FileMode mode, 
        FileAccess access);  
   public method FileStream Open(FileMode mode, 
        FileAccess access, FileShare share);  
   public method FileStream OpenRead();  
   public method StreamReader OpenText();  
   public method FileStream OpenWrite();  
   public override method string ToString();                     // overrides object
}

Hierarchy

System.ObjectSystem.MarshalByRefObjectFileSystemInfoFileInfo

Returned By

DirectoryInfo.GetFiles()

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required