Table of Contents

Class StorageFile

Namespace
Windows.Storage
Assembly
Windows.Storage.dll

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

public sealed class StorageFile : IStorageFile, IStorageItem
Inheritance
StorageFile
Implements
Inherited Members
Extension Methods

Constructors

StorageFile()

public StorageFile()

Properties

Attributes

Gets the attributes of a file.

public FileAttributes Attributes { get; }

Property Value

FileAttributes

The file attributes.

ContentType

Gets the MIME type of the contents of the file.

public string ContentType { get; }

Property Value

string

Remarks

This property is not available in nanoFramework.

DateCreated

Gets the date and time that the current folder was created.

public DateTime DateCreated { get; }

Property Value

DateTime

Remarks

This is the nanoFrameowrk equivalent of UWP DateCreated of type DateTimeOffset.

DisplayName

Gets the user-friendly name of the current folder.

public string DisplayName { get; }

Property Value

string

Remarks

This property is not available in nanoFramework.

DisplayType

Gets the user-friendly description of the type of the folder; for example, JPEG image.

public string DisplayType { get; }

Property Value

string

Remarks

This property is not available in nanoFramework.

FileType

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

public string FileType { get; }

Property Value

string

FolderRelativeId

Gets an identifier for the file. This ID is unique for the query result or StorageFolder that contains the file and can be used to distinguish between items that have the same name.

public string FolderRelativeId { get; }

Property Value

string

Remarks

This property is not available in nanoFramework.

IsAvailable

Indicates if the file is local, is cached locally, or can be downloaded.

public bool IsAvailable { get; }

Property Value

bool

True if the file is local, is cached locally, or can be downloaded. Otherwise, false.

Remarks

This property is always true in nanoFramework.

Name

Gets the name of the file including the file name extension.

public string Name { get; }

Property Value

string

The name of the file including the file name extension.

Path

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

public string Path { get; }

Property Value

string

Methods

Delete()

Delete the current file.

public void Delete()

Remarks

If the file doesn't exist this method will throw an exception.

This method is exclusive of nanoFramework and it's not available in the UWP API. The equivalent method would be DeleteAsync().

GetFileFromPath(string)

Gets a StorageFile object to represent the file at the specified path.

public static StorageFile GetFileFromPath(string path)

Parameters

path string

The path of the file to get a StorageFile to represent.

Returns

StorageFile

Returns the file as a StorageFile.

Remarks

This method is exclusive of nanoFramework and it's not available in the UWP API. The equivalent method would be GetFileFromPathAsync(String).

Rename(string)

Renames the current file.

public void Rename(string desiredName)

Parameters

desiredName string

The desired new name of the current file.

Remarks

If the name you specify is invalid or already exists, this method throws an exception

This method is exclusive of nanoFramework and it's not available in the UWP API. The equivalent method would be RenameAsync(String desiredName).