StorageProviderExtensionsTryGetFileFromPathAsync Method
Attempts to read file from the file-system by its path.
Namespace: Avalonia.Platform.StorageAssembly: Avalonia.Base (in Avalonia.Base.dll) Version: 11.3.999
public static Task<IStorageFile?> TryGetFileFromPathAsync(
this IStorageProvider provider,
string filePath
)
<ExtensionAttribute>
Public Shared Function TryGetFileFromPathAsync (
provider As IStorageProvider,
filePath As String
) As Task(Of IStorageFile)
[<ExtensionAttribute>]
static member TryGetFileFromPathAsync :
provider : IStorageProvider *
filePath : string -> Task<IStorageFile>
- provider IStorageProvider
-
- filePath String
- The path of the item to retrieve in Uri format.
TaskIStorageFileFile or null if it doesn't exist.In Visual Basic and C#, you can call this method as an instance method on any object of type
IStorageProvider. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Uri path is usually expected to be an absolute path with "file" scheme.
But it can be an uri with "content" scheme on the Android.
It also might ask user for the permission, and throw an exception if it was denied.