Table of Contents

Method StreamFromUrl

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

StreamFromUrl(string, Uri?)

Loads Stream from the specified url.

public static Stream StreamFromUrl(string url, Uri? baseUri = null)

Parameters

url string

Url used to load the data. By default "file" and "embres" protocols are supported but you can extend it with CustomStreamFromUrl event.

baseUri Uri

Returns

Stream

Examples

var ImageSize = 16;
var ResPrefix = $"embres:ControlsTest.resources.Png._{ImageSize}.";
var url = $"{ResPrefix}arrow-left-{ImageSize}.png"
using var stream = ResourceLoader.StreamFromUrl(url);
return new Bitmap(stream);

Remarks

Specifies base url if url is not absolute. url with "embres" protocol can include assembly name. Example: "embres:Alternet.UI.Resources.Svg.ImageName.svg?assembly=Alternet.UI"