[Serializable] |
In members that accept a path, the path can refer to a file or just a directory. The specified path can also refer to a relative path or a Universal Naming Convention (UNC) path for a server and share name. For example, all of the following are acceptable paths:
Attributes | Read-write Gets or sets the FileAttributes of the current FileSystemInfo. |
CreationTime | Read-write Gets or sets the creation time of the current FileSystemInfo object. |
Exists | Read-only Gets a value indicating whether the file or directory exists. |
Extension | Read-only Gets the string representing the extension part of the file. |
FullName | Read-only Gets the full path of the directory or file. |
LastAccessTime | Read-write Gets or sets the time the current file or directory was last accessed. |
LastWriteTime | Read-write Gets or sets the time when the current file or directory was last written to. |
Name | Read-only For files, gets the name of the file. For directories, gets the name of the last directory in the hierarchy if a hierarchy exists. Otherwise, the Name property gets the name of the directory. |
CreateObjRef (inherited from System.MarshalByRefObject) |
See base class member description: System.MarshalByRefObject.CreateObjRef Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. |
Delete | Deletes a file or directory. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetLifetimeService (inherited from System.MarshalByRefObject) |
See base class member description: System.MarshalByRefObject.GetLifetimeService Retrieves the current lifetime service object that controls the lifetime policy for this instance. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
InitializeLifetimeService (inherited from System.MarshalByRefObject) |
See base class member description: System.MarshalByRefObject.InitializeLifetimeService Obtains a lifetime service object to control the lifetime policy for this instance. |
Refresh | Refreshes the state of the object. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
ctor #1 | Default constructor. This constructor is called by derived class constructors to initialize state in this type. |
FullPath | Represents the fully qualified path of the directory or file. |
OriginalPath | The path originally specified by the user, whether relative or absolute. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
protected FileSystemInfo(); |
protected string FullPath;
|
protected string OriginalPath;
|
public FileAttributes Attributes {get; set;}
|
Exception Type | Condition |
---|---|
FileNotFoundException | The caller attempts to access a file that does not exist on disk. |
SecurityException | The caller does not have the required permission. |
ArgumentException | The caller attempts to set an invalid file attribute. |
IOException | FileSystemInfo.Refresh cannot initialize the data. |
public DateTime CreationTime {get; set;}
|
Exception Type | Condition |
---|---|
IOException | FileSystemInfo.Refresh cannot initialize the data. |
FileNotFoundException | The FileSystemInfo object does not exist. |
public abstract bool Exists {get;}
|
public string Extension {get;}
|
public virtual string FullName {get;}
|
public DateTime LastAccessTime {get; set;}
|
Exception Type | Condition |
---|---|
IOException | FileSystemInfo.Refresh cannot initialize the data. |
public DateTime LastWriteTime {get; set;}
|
Exception Type | Condition |
---|---|
IOException | FileSystemInfo.Refresh cannot initialize the data. |
public abstract string Name {get;}
|
For a file, Name returns only the file name and file name extension, such as MyFile.txt, not c:\Dir\Myfile.txt.
requestedType
Exception Type | Condition |
---|---|
RemotingException | This instance is not a valid remoting object. |
public abstract void Delete(); |
~FileSystemInfo(); |
public virtual int GetHashCode(); |
public object GetLifetimeService(); |
public Type GetType(); |
public virtual object InitializeLifetimeService(); |
public class MyClass : MarshalByRefObject { public override Object InitializeLifetimeService() { ILease lease = (ILease)base.InitializeLifetimeService(); if (lease.CurrentState == LeaseState.Initial) { lease.InitialLeaseTime = TimeSpan.FromMinutes(1); lease.SponsorshipTimeout = TimeSpan.FromMinutes(2); lease.RenewOnCallTime = TimeSpan.FromSeconds(2); } return lease; } }
protected object MemberwiseClone(); |
public void Refresh(); |
Exception Type | Condition |
---|---|
ArgumentException | The file is not found. |
IOException | A device such as a disk drive is not ready. |
Calls must be made to Refresh before attempting to get the attribute information, or the information will be outdated.
public virtual string ToString(); |