Skip to main content

TryGetLocalPath Method

Gets the local file system path of the item as a string.

Definition​

Namespace: Avalonia.Platform.Storage
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public static string? TryGetLocalPath(
this IStorageItem item
)

Parameters​

  IStorageItem
Storage folder or file.

Return Value​

String
Full local path to the folder or file if possible, otherwise null.

Usage Note​

In Visual Basic and C#, you can call this method as an instance method on any object of type IStorageItem. 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).

Remarks​

Android platform usually uses "content:" virtual file paths and Browser platform has isolated access without full paths, so on these platforms this method will return null.

See Also​

Reference​

StorageProviderExtensions Class
Avalonia.Platform.Storage Namespace