Sdílet prostřednictvím


IStorageFile Interface

Definition

Represents a file. Provides information about the file and its contents, and ways to manipulate them.

Important

If you simply want to work with files in your app, see the StorageFile class.

public interface class IStorageFile : IStorageItem, IInputStreamReference, IRandomAccessStreamReference
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(4198457734, 16916, 17036, 166, 76, 20, 201, 172, 115, 21, 234)]
struct IStorageFile : IStorageItem, IInputStreamReference, IRandomAccessStreamReference
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(4198457734, 16916, 17036, 166, 76, 20, 201, 172, 115, 21, 234)]
public interface IStorageFile : IStorageItem, IInputStreamReference, IRandomAccessStreamReference
Public Interface IStorageFile
Implements IInputStreamReference, IRandomAccessStreamReference, IStorageItem
Derived
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)
App capabilities
documentsLibrary musicLibrary picturesLibrary videosLibrary

Properties

Attributes

Gets the attributes of a storage item.

(Inherited from IStorageItem)
ContentType

Gets the MIME type of the contents of the file.

DateCreated

Gets the date and time when the current item was created.

(Inherited from IStorageItem)
FileType

Gets the type (file name extension) of the file.

Name

Gets the name of the item including the file name extension if there is one.

(Inherited from IStorageItem)
Path

Gets the full file-system path of the item, if the item has a path.

(Inherited from IStorageItem)

Methods

CopyAndReplaceAsync(IStorageFile)

Replaces the specified file with a copy of the current file.

CopyAsync(IStorageFolder, String, NameCollisionOption)

Creates a copy of the file in the specified folder, using the desired name. This method also specifies what to do if an existing file in the specified folder has the same name.

CopyAsync(IStorageFolder, String)

Creates a copy of the file in the specified folder, using the desired name.

CopyAsync(IStorageFolder)

Creates a copy of the file in the specified folder.

DeleteAsync()

Deletes the current item.

(Inherited from IStorageItem)
DeleteAsync(StorageDeleteOption)

Deletes the current item, optionally deleting it permanently.

(Inherited from IStorageItem)
GetBasicPropertiesAsync()

Gets the basic properties of the current item (like a file or folder).

(Inherited from IStorageItem)
IsOfType(StorageItemTypes)

Determines whether the current IStorageItem matches the specified StorageItemTypes value.

(Inherited from IStorageItem)
MoveAndReplaceAsync(IStorageFile)

Moves the current file to the location of the specified file and replaces the specified file in that location.

MoveAsync(IStorageFolder, String, NameCollisionOption)

Moves the current file to the specified folder and renames the file according to the desired name. This method also specifies what to do if a file with the same name already exists in the specified folder.

MoveAsync(IStorageFolder, String)

Moves the current file to the specified folder and renames the file according to the desired name.

MoveAsync(IStorageFolder)

Moves the current file to the specified folder.

OpenAsync(FileAccessMode)

Opens a random-access stream over the file.

OpenReadAsync()

Opens a stream for random access.

(Inherited from IRandomAccessStreamReference)
OpenSequentialReadAsync()

Opens a stream for sequential read access.

(Inherited from IInputStreamReference)
OpenTransactedWriteAsync()

Opens a transacted, random-access stream for writing to the file.

RenameAsync(String, NameCollisionOption)

Renames the current item. This method also specifies what to do if an existing item in the current item's location has the same name.

(Inherited from IStorageItem)
RenameAsync(String)

Renames the current item.

(Inherited from IStorageItem)

Applies to

See also