ResourceHelper

public static ILogger? Logger

Language: C#

Logger for debugging resource loading issues

public static Uri GetLocationUri(string resourcePath, Assembly? assembly = null)

Language: C#

The resource should be defined as 'Resource' not as 'Embedded resource'.

Parameters:

  • resourcePath: The resource path
  • assembly: If null, then use calling assembly to find the resource

Returns: URI of the resource location

public static Stream? LoadResourceFromUri(Uri uri, Assembly? asm = null)

Language: C#

Will load resource from any assembly that is part of the application.

It does not rely on Application which is specific to a (UI) frameowrk.

Parameters:

  • uri:
  • asm:

Returns: Stream of the resource if found, otherwise null

public static Stream GetAssemblyResourceStream(Assembly asm, string path)

Language: C#

The path separator is '/'. The path should not start with '/'.

Parameters:

  • asm:
  • path:

Returns: Stream of the resource if found, otherwise null