Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
1330 lines (1179 sloc) 83.3 KB
<Type Name="FileSystemInfo" FullName="System.IO.FileSystemInfo">
<TypeSignature Language="C#" Value="public abstract class FileSystemInfo : MarshalByRefObject, System.Runtime.Serialization.ISerializable" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract serializable beforefieldinit FileSystemInfo extends System.MarshalByRefObject implements class System.Runtime.Serialization.ISerializable" />
<TypeSignature Language="DocId" Value="T:System.IO.FileSystemInfo" />
<TypeSignature Language="VB.NET" Value="Public MustInherit Class FileSystemInfo&#xA;Inherits MarshalByRefObject&#xA;Implements ISerializable" />
<TypeSignature Language="C++ CLI" Value="public ref class FileSystemInfo abstract : MarshalByRefObject, System::Runtime::Serialization::ISerializable" />
<TypeSignature Language="F#" Value="type FileSystemInfo = class&#xA; inherit MarshalByRefObject&#xA; interface ISerializable" />
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
<BaseTypeName FrameworkAlternate="netframework-4.5">System.MarshalByRefObject</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.Runtime.Serialization.ISerializable</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0">
<AttributeName>System.Serializable</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Provides the base class for both <see cref="T:System.IO.FileInfo" /> and <see cref="T:System.IO.DirectoryInfo" /> objects.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.IO.FileSystemInfo> class contains methods that are common to file and directory manipulation. A <xref:System.IO.FileSystemInfo> object can represent either a file or a directory, thus serving as the basis for <xref:System.IO.FileInfo> or <xref:System.IO.DirectoryInfo> objects. Use this base class when parsing a lot of files and directories.
A derived class can inherit from <xref:System.IO.FileSystemInfo> only if the derived class has the AllAccess permission from the <xref:System.Security.Permissions.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.
For a list of common I/O tasks, see [Common I/O Tasks](~/docs/standard/io/common-i-o-tasks.md).
## Examples
The following example shows how to loop through all the files and directories, querying some information about each entry.
[!code-cpp[FileSystemInfo#1](~/samples/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp#1)]
[!code-csharp[FileSystemInfo#1](~/samples/snippets/csharp/VS_Snippets_CLR/FileSystemInfo/CS/program.cs#1)]
[!code-vb[FileSystemInfo#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/FileSystemInfo/VB/FileSystemInfo.vb#1)]
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.FileIOPermission">for permission to inherit from this class. Associated enumeration: <see cref="F:System.Security.Permissions.PermissionState.Unrestricted" />
Security Action: Inheritance Demand</permission>
<altmember cref="T:System.IO.FileSystemWatcher" />
<altmember cref="T:System.IO.DriveInfo" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
<related type="Article" href="~/docs/standard/io/how-to-read-and-write-to-a-newly-created-data-file.md">How to: Read and Write to a Newly Created Data File</related>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.IO.FileSystemInfo" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected FileSystemInfo ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileSystemInfo.#ctor" />
<MemberSignature Language="VB.NET" Value="Protected Sub New ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; FileSystemInfo();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.IO.FileSystemInfo" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For a list of common I/O tasks, see [Common I/O Tasks](~/docs/standard/io/common-i-o-tasks.md).
]]></format>
</remarks>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected FileSystemInfo (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(class System.Runtime.Serialization.SerializationInfo info, valuetype System.Runtime.Serialization.StreamingContext context) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileSystemInfo.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
<MemberSignature Language="VB.NET" Value="Protected Sub New (info As SerializationInfo, context As StreamingContext)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; FileSystemInfo(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);" />
<MemberSignature Language="F#" Value="new System.IO.FileSystemInfo : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -&gt; System.IO.FileSystemInfo" Usage="new System.IO.FileSystemInfo (info, context)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1;netcore-3.1" />
<Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1;netcore-3.1" />
</Parameters>
<Docs>
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
<summary>Initializes a new instance of the <see cref="T:System.IO.FileSystemInfo" /> class with serialized data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For a list of common I/O tasks, see [Common I/O Tasks](~/docs/standard/io/common-i-o-tasks.md).
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The specified <see cref="T:System.Runtime.Serialization.SerializationInfo" /> is null.</exception>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="Attributes">
<MemberSignature Language="C#" Value="public System.IO.FileAttributes Attributes { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.IO.FileAttributes Attributes" />
<MemberSignature Language="DocId" Value="P:System.IO.FileSystemInfo.Attributes" />
<MemberSignature Language="VB.NET" Value="Public Property Attributes As FileAttributes" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::IO::FileAttributes Attributes { System::IO::FileAttributes get(); void set(System::IO::FileAttributes value); };" />
<MemberSignature Language="F#" Value="member this.Attributes : System.IO.FileAttributes with get, set" Usage="System.IO.FileSystemInfo.Attributes" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>set: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.FileAttributes</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the attributes for the current file or directory.</summary>
<value>
<see cref="T:System.IO.FileAttributes" /> of the current <see cref="T:System.IO.FileSystemInfo" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The value of the <xref:System.IO.FileSystemInfo.Attributes%2A> property is pre-cached if the current instance of the <xref:System.IO.FileSystemInfo> object was returned from any of the following <xref:System.IO.DirectoryInfo> methods:
- <xref:System.IO.DirectoryInfo.GetDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFileSystemInfos%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFileSystemInfos%2A?displayProperty=nameWithType>
The value may be cached when either the value itself or other <xref:System.IO.FileSystemInfo> properties are accessed. To get the latest value, call the <xref:System.IO.FileSystemInfo.Refresh%2A> method.
If the path doesn't exist as of the last cached state, the return value is `(FileAttributes)(-1)`. <xref:System.IO.FileNotFoundException> or <xref:System.IO.DirectoryNotFoundException> can only be thrown when setting the value.
The value of this property is a combination of the archive, compressed, directory, hidden, offline, read-only, system, and temporary file attribute flags.
When you set this value, use the bitwise OR operator (`|` in C# or `Or` in Visual Basic) to apply more than one value. To retain any existing values in the <xref:System.IO.FileSystemInfo.Attributes%2A> property, include the value of the <xref:System.IO.FileSystemInfo.Attributes%2A> property in your assignment. For example:
`exampleFile.Attributes = exampleFile.Attributes | FileAttributes.ReadOnly;`
## Examples
The following example demonstrates the <xref:System.IO.FileSystemInfo.Attributes%2A> property. This code example is part of a larger example provided for the <xref:System.IO.FileSystemInfo> class.
[!code-cpp[FileSystemInfo#2](~/samples/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp#2)]
[!code-csharp[FileSystemInfo#2](~/samples/snippets/csharp/VS_Snippets_CLR/FileSystemInfo/CS/program.cs#2)]
[!code-vb[FileSystemInfo#2](~/samples/snippets/visualbasic/VS_Snippets_CLR/FileSystemInfo/VB/FileSystemInfo.vb#2)]
]]></format>
</remarks>
<exception cref="T:System.IO.FileNotFoundException">The specified file doesn't exist. Only thrown when setting the property value.</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid. For example, it's on an unmapped drive. Only thrown when setting the property value.</exception>
<exception cref="T:System.Security.SecurityException">The caller doesn't have the required permission.</exception>
<exception cref="T:System.ArgumentException">The caller attempts to set an invalid file attribute.
-or-
The user attempts to set an attribute value but doesn't have write permission.</exception>
<exception cref="T:System.IO.IOException">
<see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data.</exception>
<permission cref="T:System.Security.Permissions.FileIOPermission">for writing files and directories. Associated enumeration: <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" /> Security action: <see cref="F:System.Security.Permissions.SecurityAction.Demand" /></permission>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="CreationTime">
<MemberSignature Language="C#" Value="public DateTime CreationTime { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.DateTime CreationTime" />
<MemberSignature Language="DocId" Value="P:System.IO.FileSystemInfo.CreationTime" />
<MemberSignature Language="VB.NET" Value="Public Property CreationTime As DateTime" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property DateTime CreationTime { DateTime get(); void set(DateTime value); };" />
<MemberSignature Language="F#" Value="member this.CreationTime : DateTime with get, set" Usage="System.IO.FileSystemInfo.CreationTime" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the creation time of the current file or directory.</summary>
<value>The creation date and time of the current <see cref="T:System.IO.FileSystemInfo" /> object.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!NOTE]
> This method may return an inaccurate value because it uses native functions whose values may not be continuously updated by the operating system.
The value of the <xref:System.IO.FileSystemInfo.CreationTime%2A> property is pre-cached if the current instance of the <xref:System.IO.FileSystemInfo> object was returned from any of the following <xref:System.IO.DirectoryInfo> methods:
- <xref:System.IO.DirectoryInfo.GetDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFileSystemInfos%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFileSystemInfos%2A?displayProperty=nameWithType>
To get the latest value, call the <xref:System.IO.FileSystemInfo.Refresh%2A> method.
If the file described in the <xref:System.IO.FileSystemInfo> object does not exist, this property returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.
On Unix platforms that do not support creation or birth time, this property returns the older of the time of the last status change and the time of the last modification. On other platforms, it returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.
NTFS-formatted drives may cache file meta-info, such as file creation time, for a short period of time. This process is known as file tunneling. As a result, it may be necessary to explicitly set the creation time of a file if you are overwriting or replacing an existing file.
## Examples
The following example demonstrates the <xref:System.IO.FileSystemInfo.CreationTime%2A> property. This code example is part of a larger example provided for the <xref:System.IO.FileSystemInfo> class.
[!code-cpp[FileSystemInfo#2](~/samples/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp#2)]
[!code-csharp[FileSystemInfo#2](~/samples/snippets/csharp/VS_Snippets_CLR/FileSystemInfo/CS/program.cs#2)]
[!code-vb[FileSystemInfo#2](~/samples/snippets/visualbasic/VS_Snippets_CLR/FileSystemInfo/VB/FileSystemInfo.vb#2)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">
<see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data.</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid; for example, it is on an unmapped drive.</exception>
<exception cref="T:System.PlatformNotSupportedException">The current operating system is not Windows NT or later.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The caller attempts to set an invalid creation time.</exception>
<permission cref="T:System.Security.Permissions.FileIOPermission">for setting the creation time. Associated enumeration: <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" /></permission>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="CreationTimeUtc">
<MemberSignature Language="C#" Value="public DateTime CreationTimeUtc { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.DateTime CreationTimeUtc" />
<MemberSignature Language="DocId" Value="P:System.IO.FileSystemInfo.CreationTimeUtc" />
<MemberSignature Language="VB.NET" Value="Public Property CreationTimeUtc As DateTime" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property DateTime CreationTimeUtc { DateTime get(); void set(DateTime value); };" />
<MemberSignature Language="F#" Value="member this.CreationTimeUtc : DateTime with get, set" Usage="System.IO.FileSystemInfo.CreationTimeUtc" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the creation time, in coordinated universal time (UTC), of the current file or directory.</summary>
<value>The creation date and time in UTC format of the current <see cref="T:System.IO.FileSystemInfo" /> object.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!NOTE]
> This method may return an inaccurate value because it uses native functions whose values may not be continuously updated by the operating system.
The value of the <xref:System.IO.FileSystemInfo.CreationTimeUtc%2A> property is pre-cached if the current instance of the <xref:System.IO.FileSystemInfo> object was returned from any of the following <xref:System.IO.DirectoryInfo> methods:
- <xref:System.IO.DirectoryInfo.GetDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFileSystemInfos%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFileSystemInfos%2A?displayProperty=nameWithType>
To get the latest value, call the <xref:System.IO.FileSystemInfo.Refresh%2A> method.
If the file described in the <xref:System.IO.FileSystemInfo> object does not exist, this property returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC).
On Unix platforms that do not support creation or birth time, this property returns the older of the time of the last status change and the time of the last modification. On other platforms, it returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.
NTFS-formatted drives may cache file meta-info, such as file creation time, for a short period of time. This process is known as file tunneling. As a result, it may be necessary to explicitly set the creation time of a file if you are overwriting or replacing an existing file.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">
<see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data.</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid; for example, it is on an unmapped drive.</exception>
<exception cref="T:System.PlatformNotSupportedException">The current operating system is not Windows NT or later.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The caller attempts to set an invalid access time.</exception>
<permission cref="T:System.Security.Permissions.FileIOPermission">for setting the creation time. Associated enumeration: <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" /></permission>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="Delete">
<MemberSignature Language="C#" Value="public abstract void Delete ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Delete() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileSystemInfo.Delete" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Sub Delete ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract void Delete();" />
<MemberSignature Language="F#" Value="abstract member Delete : unit -&gt; unit" Usage="fileSystemInfo.Delete " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Deletes a file or directory.</summary>
<remarks>To be added.</remarks>
<exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid; for example, it is on an unmapped drive.</exception>
<exception cref="T:System.IO.IOException">There is an open handle on the file or directory, and the operating system is Windows XP or earlier. This open handle can result from enumerating directories and files. For more information, see [How to: Enumerate Directories and Files](~/docs/standard/io/how-to-enumerate-directories-and-files.md).</exception>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="Exists">
<MemberSignature Language="C#" Value="public abstract bool Exists { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool Exists" />
<MemberSignature Language="DocId" Value="P:System.IO.FileSystemInfo.Exists" />
<MemberSignature Language="VB.NET" Value="Public MustOverride ReadOnly Property Exists As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract property bool Exists { bool get(); };" />
<MemberSignature Language="F#" Value="member this.Exists : bool" Usage="System.IO.FileSystemInfo.Exists" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the file or directory exists.</summary>
<value>
<see langword="true" /> if the file or directory exists; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For a list of common I/O tasks, see [Common I/O Tasks](~/docs/standard/io/common-i-o-tasks.md).
]]></format>
</remarks>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="Extension">
<MemberSignature Language="C#" Value="public string Extension { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Extension" />
<MemberSignature Language="DocId" Value="P:System.IO.FileSystemInfo.Extension" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Extension As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::String ^ Extension { System::String ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Extension : string" Usage="System.IO.FileSystemInfo.Extension" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the string representing the extension part of the file.</summary>
<value>A string containing the <see cref="T:System.IO.FileSystemInfo" /> extension.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The `Extension` property returns the <xref:System.IO.FileSystemInfo> extension, including the period (.). For example, for a file c:\NewFile.txt, this property returns ".txt".
The following table lists examples of other typical or related I/O tasks.
|To do this...|See the example in this topic...|
|-------------------|--------------------------------------|
|Create a text file.|[How to: Write Text to a File](~/docs/standard/io/how-to-write-text-to-a-file.md)|
|Write to a text file.|[How to: Write Text to a File](~/docs/standard/io/how-to-write-text-to-a-file.md)|
|Read from a text file.|[How to: Read Text from a File](~/docs/standard/io/how-to-read-text-from-a-file.md)|
|Retrieve the fully qualified path of a file.|<xref:System.IO.Path.GetFullPath%2A>|
|Retrieve only the file name a path.|<xref:System.IO.Path.GetFileNameWithoutExtension%2A>|
|Retrieve only the directory name from a path.|<xref:System.IO.Path.GetDirectoryName%2A>|
|Change the extension of a file.|<xref:System.IO.Path.ChangeExtension%2A>|
]]></format>
</remarks>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="FullName">
<MemberSignature Language="C#" Value="public virtual string FullName { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string FullName" />
<MemberSignature Language="DocId" Value="P:System.IO.FileSystemInfo.FullName" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property FullName As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ FullName { System::String ^ get(); };" />
<MemberSignature Language="F#" Value="member this.FullName : string" Usage="System.IO.FileSystemInfo.FullName" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the full path of the directory or file.</summary>
<value>A string containing the full path.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For example, for a file c:\NewFile.txt, this property returns "c:\NewFile.txt".
For a list of common I/O tasks, see [Common I/O Tasks](~/docs/standard/io/common-i-o-tasks.md).
## Examples
The following example demonstrates the <xref:System.IO.FileSystemInfo.FullName%2A> property. This code example is part of a larger example provided for the <xref:System.IO.FileSystemInfo> class.
[!code-cpp[FileSystemInfo#2](~/samples/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp#2)]
[!code-csharp[FileSystemInfo#2](~/samples/snippets/csharp/VS_Snippets_CLR/FileSystemInfo/CS/program.cs#2)]
[!code-vb[FileSystemInfo#2](~/samples/snippets/visualbasic/VS_Snippets_CLR/FileSystemInfo/VB/FileSystemInfo.vb#2)]
]]></format>
</remarks>
<exception cref="T:System.IO.PathTooLongException">The fully qualified path and file name exceed the system-defined maximum length. </exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
<permission cref="T:System.Security.Permissions.FileIOPermission">for access to the path. Associated enumeration: <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /></permission>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="FullPath">
<MemberSignature Language="C#" Value="protected string FullPath;" />
<MemberSignature Language="ILAsm" Value=".field family string FullPath" />
<MemberSignature Language="DocId" Value="F:System.IO.FileSystemInfo.FullPath" />
<MemberSignature Language="VB.NET" Value="Protected FullPath As String " />
<MemberSignature Language="C++ CLI" Value="protected: System::String ^ FullPath;" />
<MemberSignature Language="F#" Value="val mutable FullPath : string" Usage="System.IO.FileSystemInfo.FullPath" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Represents the fully qualified path of the directory or file.</summary>
<remarks>To be added.</remarks>
<exception cref="T:System.IO.PathTooLongException">The fully qualified path exceeds the system-defined maximum length.</exception>
<block subset="none" type="overrides">
<para>Classes derived from <see cref="T:System.IO.FileSystemInfo" /> can use the <see langword="FullPath" /> field to determine the full path of the object being manipulated.
For a list of common I/O tasks, see [Common I/O Tasks](~/docs/standard/io/common-i-o-tasks.md).</para>
</block>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="GetObjectData">
<MemberSignature Language="C#" Value="public virtual void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void GetObjectData(class System.Runtime.Serialization.SerializationInfo info, valuetype System.Runtime.Serialization.StreamingContext context) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileSystemInfo.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Sub GetObjectData (info As SerializationInfo, context As StreamingContext)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void GetObjectData(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);" />
<MemberSignature Language="F#" Value="abstract member GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -&gt; unit&#xA;override this.GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -&gt; unit" Usage="fileSystemInfo.GetObjectData (info, context)" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1;netcore-3.1" />
<Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1;netcore-3.1" />
</Parameters>
<Docs>
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
<summary>Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the file name and additional exception information.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For a list of common I/O tasks, see [Common I/O Tasks](~/docs/standard/io/common-i-o-tasks.md).
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.FileIOPermission">for permission to access information about the path described by the current instance. Associated enumeration: <see cref="T:System.Security.Permissions.FileIOPermissionAccess" />
Security action: Demand</permission>
<permission cref="T:System.Security.Permissions.SecurityPermission">for permission to link to this class. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.SerializationFormatter" />
Security action: Link Demand</permission>
<permission cref="T:System.Security.SecurityCriticalAttribute">requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.</permission>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="LastAccessTime">
<MemberSignature Language="C#" Value="public DateTime LastAccessTime { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.DateTime LastAccessTime" />
<MemberSignature Language="DocId" Value="P:System.IO.FileSystemInfo.LastAccessTime" />
<MemberSignature Language="VB.NET" Value="Public Property LastAccessTime As DateTime" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property DateTime LastAccessTime { DateTime get(); void set(DateTime value); };" />
<MemberSignature Language="F#" Value="member this.LastAccessTime : DateTime with get, set" Usage="System.IO.FileSystemInfo.LastAccessTime" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the time the current file or directory was last accessed.</summary>
<value>The time that the current file or directory was last accessed.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!NOTE]
> This method may return an inaccurate value because it uses native functions whose values may not be continuously updated by the operating system.
If the file described in the <xref:System.IO.FileSystemInfo> object does not exist, this property returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.
The value of the <xref:System.IO.FileSystemInfo.LastAccessTimeUtc%2A> property is pre-cached if the current instance of the <xref:System.IO.FileSystemInfo> object was returned from any of the following <xref:System.IO.DirectoryInfo> methods:
- <xref:System.IO.DirectoryInfo.GetDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFileSystemInfos%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFileSystemInfos%2A?displayProperty=nameWithType>
To get the latest value, call the <xref:System.IO.FileSystemInfo.Refresh%2A> method.
## Examples
The following code example demonstrates the updating of the <xref:System.IO.FileSystemInfo.LastAccessTime%2A> property through a "touch" operation. In this example, the file is "touched", updating the <xref:System.IO.FileSystemInfo.CreationTime%2A>, <xref:System.IO.FileSystemInfo.LastAccessTime%2A> and <xref:System.IO.FileSystemInfo.LastWriteTime%2A> properties to the current date and time.
[!code-csharp[System.IO.FileSystemInfo_touch#00](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.FileSystemInfo_touch/cs/touch.cs#00)]
[!code-vb[System.IO.FileSystemInfo_touch#00](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileSystemInfo_touch/vb/touch.vb#00)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">
<see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data.</exception>
<exception cref="T:System.PlatformNotSupportedException">The current operating system is not Windows NT or later.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The caller attempts to set an invalid access time</exception>
<permission cref="T:System.Security.Permissions.FileIOPermission">for setting the last access time. Associated enumeration: <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" /></permission>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="LastAccessTimeUtc">
<MemberSignature Language="C#" Value="public DateTime LastAccessTimeUtc { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.DateTime LastAccessTimeUtc" />
<MemberSignature Language="DocId" Value="P:System.IO.FileSystemInfo.LastAccessTimeUtc" />
<MemberSignature Language="VB.NET" Value="Public Property LastAccessTimeUtc As DateTime" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property DateTime LastAccessTimeUtc { DateTime get(); void set(DateTime value); };" />
<MemberSignature Language="F#" Value="member this.LastAccessTimeUtc : DateTime with get, set" Usage="System.IO.FileSystemInfo.LastAccessTimeUtc" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed.</summary>
<value>The UTC time that the current file or directory was last accessed.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!NOTE]
> This method may return an inaccurate value because it uses native functions whose values may not be continuously updated by the operating system.
The value of the <xref:System.IO.FileSystemInfo.LastAccessTimeUtc%2A> property is pre-cached if the current instance of the <xref:System.IO.FileSystemInfo> object was returned from any of the following <xref:System.IO.DirectoryInfo> methods:
- <xref:System.IO.DirectoryInfo.GetDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFileSystemInfos%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFileSystemInfos%2A?displayProperty=nameWithType>
To get the latest value, call the <xref:System.IO.FileSystemInfo.Refresh%2A> method.
If the file described in the <xref:System.IO.FileSystemInfo> object does not exist, this property returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC).
For a list of common I/O tasks, see [Common I/O Tasks](~/docs/standard/io/common-i-o-tasks.md).
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">
<see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data.</exception>
<exception cref="T:System.PlatformNotSupportedException">The current operating system is not Windows NT or later.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The caller attempts to set an invalid access time.</exception>
<permission cref="T:System.Security.Permissions.FileIOPermission">for setting the last access time. Associated enumeration: <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" /></permission>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="LastWriteTime">
<MemberSignature Language="C#" Value="public DateTime LastWriteTime { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.DateTime LastWriteTime" />
<MemberSignature Language="DocId" Value="P:System.IO.FileSystemInfo.LastWriteTime" />
<MemberSignature Language="VB.NET" Value="Public Property LastWriteTime As DateTime" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property DateTime LastWriteTime { DateTime get(); void set(DateTime value); };" />
<MemberSignature Language="F#" Value="member this.LastWriteTime : DateTime with get, set" Usage="System.IO.FileSystemInfo.LastWriteTime" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the time when the current file or directory was last written to.</summary>
<value>The time the current file was last written.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!NOTE]
> This method may return an inaccurate value because it uses native functions whose values may not be continuously updated by the operating system.
The value of the <xref:System.IO.FileSystemInfo.LastWriteTime%2A> property is pre-cached if the current instance of the <xref:System.IO.FileSystemInfo> object was returned from any of the following <xref:System.IO.DirectoryInfo> methods:
- <xref:System.IO.DirectoryInfo.GetDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFileSystemInfos%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFileSystemInfos%2A?displayProperty=nameWithType>
To get the latest value, call the <xref:System.IO.FileSystemInfo.Refresh%2A> method.
If the file or directory described in the <xref:System.IO.FileSystemInfo> object does not exist, or if the file system that contains this file or directory does not support this information, this property returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.
## Examples
The following code example demonstrates the updating of the <xref:System.IO.FileSystemInfo.LastWriteTime%2A> property through a "touch" operation. In this example, the file is "touched", updating the <xref:System.IO.FileSystemInfo.CreationTime%2A>, <xref:System.IO.FileSystemInfo.LastAccessTime%2A> and <xref:System.IO.FileSystemInfo.LastWriteTime%2A> properties to the current date and time.
[!code-csharp[System.IO.FileSystemInfo_touch#00](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.FileSystemInfo_touch/cs/touch.cs#00)]
[!code-vb[System.IO.FileSystemInfo_touch#00](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileSystemInfo_touch/vb/touch.vb#00)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">
<see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data.</exception>
<exception cref="T:System.PlatformNotSupportedException">The current operating system is not Windows NT or later.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The caller attempts to set an invalid write time.</exception>
<permission cref="T:System.Security.Permissions.FileIOPermission">for setting the last write time. Associated enumeration: <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" /></permission>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="LastWriteTimeUtc">
<MemberSignature Language="C#" Value="public DateTime LastWriteTimeUtc { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.DateTime LastWriteTimeUtc" />
<MemberSignature Language="DocId" Value="P:System.IO.FileSystemInfo.LastWriteTimeUtc" />
<MemberSignature Language="VB.NET" Value="Public Property LastWriteTimeUtc As DateTime" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property DateTime LastWriteTimeUtc { DateTime get(); void set(DateTime value); };" />
<MemberSignature Language="F#" Value="member this.LastWriteTimeUtc : DateTime with get, set" Usage="System.IO.FileSystemInfo.LastWriteTimeUtc" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>get: System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.</summary>
<value>The UTC time when the current file was last written to.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!NOTE]
> This method may return an inaccurate value because it uses native functions whose values may not be continuously updated by the operating system.
The value of the <xref:System.IO.FileSystemInfo.LastWriteTimeUtc%2A> property is pre-cached if the current instance of the <xref:System.IO.FileSystemInfo> object was returned from any of the following <xref:System.IO.DirectoryInfo> methods:
- <xref:System.IO.DirectoryInfo.GetDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.GetFileSystemInfos%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateDirectories%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFiles%2A?displayProperty=nameWithType>
- <xref:System.IO.DirectoryInfo.EnumerateFileSystemInfos%2A?displayProperty=nameWithType>
To get the latest value, call the <xref:System.IO.FileSystemInfo.Refresh%2A> method.
If the file or directory described in the <xref:System.IO.FileSystemInfo> object does not exist, or if the file system that contains this file or directory does not support this information, this property returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC).
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">
<see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data.</exception>
<exception cref="T:System.PlatformNotSupportedException">The current operating system is not Windows NT or later.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The caller attempts to set an invalid write time.</exception>
<permission cref="T:System.Security.Permissions.FileIOPermission">for setting the last write time. Associated enumeration: <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" /></permission>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="Name">
<MemberSignature Language="C#" Value="public abstract string Name { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Name" />
<MemberSignature Language="DocId" Value="P:System.IO.FileSystemInfo.Name" />
<MemberSignature Language="VB.NET" Value="Public MustOverride ReadOnly Property Name As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract property System::String ^ Name { System::String ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Name : string" Usage="System.IO.FileSystemInfo.Name" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>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 <see langword="Name" /> property gets the name of the directory.</summary>
<value>A string that is the name of the parent directory, the name of the last directory in the hierarchy, or the name of a file, including the file name extension.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For a directory, `Name` returns only the name of the parent directory, such as Dir, not c:\Dir. For a subdirectory, `Name` returns only the name of the subdirectory, such as Sub1, not c:\Dir\Sub1.
For a file, `Name` returns only the file name and file name extension, such as MyFile.txt, not c:\Dir\Myfile.txt.
]]></format>
</remarks>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="OriginalPath">
<MemberSignature Language="C#" Value="protected string OriginalPath;" />
<MemberSignature Language="ILAsm" Value=".field family string OriginalPath" />
<MemberSignature Language="DocId" Value="F:System.IO.FileSystemInfo.OriginalPath" />
<MemberSignature Language="VB.NET" Value="Protected OriginalPath As String " />
<MemberSignature Language="C++ CLI" Value="protected: System::String ^ OriginalPath;" />
<MemberSignature Language="F#" Value="val mutable OriginalPath : string" Usage="System.IO.FileSystemInfo.OriginalPath" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>The path originally specified by the user, whether relative or absolute.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For a list of common I/O tasks, see [Common I/O Tasks](~/docs/standard/io/common-i-o-tasks.md).
]]></format>
</remarks>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="Refresh">
<MemberSignature Language="C#" Value="public void Refresh ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Refresh() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileSystemInfo.Refresh" />
<MemberSignature Language="VB.NET" Value="Public Sub Refresh ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Refresh();" />
<MemberSignature Language="F#" Value="member this.Refresh : unit -&gt; unit" Usage="fileSystemInfo.Refresh " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.Security.SecuritySafeCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Refreshes the state of the object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
`FileSystemInfo.Refresh` takes a snapshot of the file from the current file system. `Refresh` cannot correct the underlying file system even if the file system returns incorrect or outdated information. This can happen on platforms such as Windows 98.
Calls must be made to `Refresh` before attempting to get the attribute information, or the information will be outdated.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">A device such as a disk drive is not ready.</exception>
<altmember cref="T:System.IO.FileSystemWatcher" />
<related type="Article" href="~/docs/standard/io/index.md">File and Stream I/O</related>
<related type="Article" href="~/docs/standard/io/how-to-read-text-from-a-file.md">How to: Read Text from a File</related>
<related type="Article" href="~/docs/standard/io/how-to-write-text-to-a-file.md">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="ToString">
<MemberSignature Language="C#" Value="public override string ToString ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileSystemInfo.ToString" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function ToString () As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; override System::String ^ ToString();" />
<MemberSignature Language="F#" Value="override this.ToString : unit -&gt; string" Usage="fileSystemInfo.ToString " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Returns the original path. Use the <see cref="P:System.IO.FileSystemInfo.FullName" /> or <see cref="P:System.IO.FileSystemInfo.Name" /> properties for the full path or file/directory name.</summary>
<returns>A string with the original path.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!IMPORTANT]
> The string returned by the`ToString` method represents the path that was passed to the constructor of the class implementing <xref:System.IO.FileSystemInfo>. Instead of calling the `ToString` method, you should retrieve the value of either of the following properties, depending on your intent:
> - <xref:System.IO.FileSystemInfo.Name>, to get the name of the file or directory, without any parent path information.
> - <xref:System.IO.FileSystemInfo.FullName>, to get the fully qualified path of the file or directory.
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.