Provides the base class for both FileInfo and DirectoryInfo objects.
For a list of all members of this type, see FileSystemInfo Members.
System.Object
System.MarshalByRefObject
System.IO.FileSystemInfo
System.IO.DirectoryInfo
System.IO.FileInfo
[Visual Basic]
<Serializable>
MustInherit Public Class FileSystemInfo
Inherits MarshalByRefObject
Implements ISerializable
[C#]
[Serializable]
public abstract class FileSystemInfo : MarshalByRefObject,
ISerializable
[C++]
[Serializable]
public __gc __abstract class FileSystemInfo : public
MarshalByRefObject, ISerializable
[JScript]
public
Serializable
abstract class FileSystemInfo extends MarshalByRefObject
implements ISerializable
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
The FileSystemInfo class contains methods that are common to file and directory manipulation. A FileSystemInfo object can represent either a file or a directory, thus serving as the basis for FileInfo or DirectoryInfo objects. Use this base class when parsing a lot of files and directories.
When first called, FileSystemInfo calls Refresh and returns the cached information on APIs to get attributes and so on. On subsequent calls, you must call Refresh to get the latest copy of the information.
A derived class can inherit from FileSystemInfo only if the derived class has the AllAccess permission from the FileIOPermissionAccess enumeration.
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 the following are acceptable paths:
- "c:\\MyDir\\MyFile.txt" in C#, or "c:\MyDir\MyFile.txt" in Visual Basic.
- "c:\\MyDir" in C#, or "c:\MyDir" in Visual Basic.
- "MyDir\\MySubdir" in C#, or "MyDir\MySubDir" in Visual Basic.
- "\\\\MyServer\\MyShare" in C#, or "\\MyServer\MyShare" in Visual Basic.
The following table lists examples of other typical or related I/O tasks.
Requirements
Namespace: System.IO
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
Assembly: Mscorlib (in Mscorlib.dll)
See Also
FileSystemInfo Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File | Basic File I/O | Reading and Writing to a Newly Created Data File