Show / Hide Table of Contents

Class ResourceUtil

Gets managed resources from a .NET assembly.

public static class ResourceUtil
Remarks

Internally uses System.Resources.ResourceManager. Uses System.Globalization.CultureInfo.InvariantCulture.

Loads resources from managed resource "AssemblyName.g.resources". To add such resource files in Visual Studio, set file build action = Resource. Don't use .resx files and the Resources page in Project Properties.

By default loads resources from the app entry assembly. In script with role miniProgram - from the script's assembly. To specify another loaded assembly, use prefix like "<AssemblyName>" or "*<AssemblyName>".

The resource name argument can optionally start with "resource:".

Does not use caching. Creates new object even when loading the resource not the first time.


Namespace: Au.More
Assembly: Au.dll
Inheritance
object
ResourceUtil

Methods

Name Description
GetBytes(string)

Gets byte[].

GetGdipBitmap(string)

Gets GDI+ image.

GetStream(string)

Gets stream.

GetString(string)

Gets string.

GetWpfImage(string)

Gets WPF image or icon that can be used as ImageSource.

GetWpfImageElement(string)

Gets WPF image element from XAML or other image resource.

GetXamlObject(string)

Gets WPF object from XAML resource, for example image.

Get<T>(string)

Gets resource of any type.

HasResourcePrefix(string)

Returns true if string starts with "resource:" or "resources/".