Table of Contents

Method StreamFromUrlOr

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

StreamFromUrlOr(string?, Uri?, Func<Stream?>?)

Attempts to load a Stream from the specified URL or uses a fallback function if provided.

public static Stream? StreamFromUrlOr(string? url, Uri? baseUri, Func<Stream?>? func = null)

Parameters

url string

The URL used to load the data. By default, "file" and "embres" protocols are supported, but this can be extended using the CustomStreamFromUrl event.

baseUri Uri

Specifies the base URL if url is not absolute.

func Func<Stream>

A fallback function to invoke if the default loading mechanism fails.

Returns

Stream

A Stream loaded from the specified URL, or the result of the fallback function if provided and the default mechanism fails. Returns null if no stream could be loaded.