Skip to main content

IStorageFolder Interface

Definition

Assembly:Avalonia.Base
Package:Avalonia

Manipulates folders and their contents, and provides information about them.

public interface IStorageFolder

Implements: IStorageItem, IDisposable

Methods

NameDescription
CreateFileAsyncCreates, or truncates and overwrites, a file with specified name as a child of the current storage folder.
CreateFolderAsyncCreates a folder with specified name as a child of the current storage folder unless they already exist.
GetFileAsyncGets the file with the specified name from the current folder.
GetFolderAsyncGets the folder with the specified name from the current folder.
GetItemsAsyncGets the files and subfolders in the current folder.

CreateFileAsync Method

Creates, or truncates and overwrites, a file with specified name as a child of the current storage folder.

public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFile> CreateFileAsync(string name)

Parameters

name string

The display name

Returns

System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFile>

A Avalonia.Platform.Storage.IStorageFile that provides read/write access to the file specified in name.

CreateFolderAsync Method

Creates a folder with specified name as a child of the current storage folder unless they already exist.

public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFolder> CreateFolderAsync(string name)

Parameters

name string

The display name

Returns

System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFolder>

A Avalonia.Platform.Storage.IStorageFolder that represents the directory at the specified name. This object is returned regardless of whether a directory at the specified name already exists.

GetFileAsync Method

Gets the file with the specified name from the current folder.

public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFile> GetFileAsync(string name)

Parameters

name string

The name of the file to get

Returns

System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFile>

When this method completes successfully, it returns the file with the specified name from the current folder.

GetFolderAsync Method

Gets the folder with the specified name from the current folder.

public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFolder> GetFolderAsync(string name)

Parameters

name string

The name of the folder to get

Returns

System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFolder>

When this method completes successfully, it returns the folder with the specified name from the current folder.

GetItemsAsync Method

Gets the files and subfolders in the current folder.

public System.Collections.Generic.IAsyncEnumerable<Avalonia.Platform.Storage.IStorageItem> GetItemsAsync()

Returns

System.Collections.Generic.IAsyncEnumerable<Avalonia.Platform.Storage.IStorageItem>

When this method completes successfully, it returns a list of the files and folders in the current folder. Each item in the list is represented by an Avalonia.Platform.Storage.IStorageItem implementation object.