Class GorgonResourceLocator
A locator extension for GorgonGraphicsResource objects.
Inherited Members
Namespace: Gorgon.Graphics.Core
Assembly: Gorgon.Graphics.Core.dll
Syntax
public static class GorgonResourceLocator
Methods
| Edit this page View SourceLocateResourcesByName<T>(GorgonGraphics, string, LocateFilterType, StringComparison)
Function to locate a graphics resource by its name.
Declaration
public static IEnumerable<T> LocateResourcesByName<T>(this GorgonGraphics graphics, string name, LocateFilterType filterType = LocateFilterType.Equal, StringComparison comparisonType = StringComparison.CurrentCultureIgnoreCase) where T : GorgonGraphicsResource
Parameters
Type | Name | Description |
---|---|---|
GorgonGraphics | graphics | The graphics instance that was used to create the resource. |
string | name | The name of the resource to find. |
LocateFilterType | filterType | [Optional] The type of filter to apply. |
StringComparison | comparisonType | [Optional] The type of string comparison to use for name comparison. |
Returns
Type | Description |
---|---|
IEnumerable<T> | An enumerable containing the resources with names that match the filter type. |
Type Parameters
Name | Description |
---|---|
T | The type of graphics resource to look up. Must inherit from GorgonGraphicsResource. |
Remarks
Each instance of the GorgonGraphics keeps a weak registration of each objected inheriting from GorgonGraphicsResource that was created during the lifetime of the application. Using this registration an application can look up any previously created resource (assuming it's not been collected, or disposed) should it be necessary.
important
Resource names are not required to be unique. Therefore, searching for the name may result in multiple items being returned in the enumerable.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
See Also
| Edit this page View SourceLocateResourcesByType<T>(GorgonGraphics)
Function to locate a graphics resource by its type.
Declaration
public static IEnumerable<T> LocateResourcesByType<T>(this GorgonGraphics graphics) where T : GorgonGraphicsResource
Parameters
Type | Name | Description |
---|---|---|
GorgonGraphics | graphics | The graphics instance that was used to create the resource. |
Returns
Type | Description |
---|---|
IEnumerable<T> | An enumerable containing the resources with names that match the filter type. |
Type Parameters
Name | Description |
---|---|
T | The type of graphics resource to look up. Must inherit from GorgonGraphicsResource. |
Remarks
Each instance of the GorgonGraphics keeps a weak registration of each objected inheriting from GorgonGraphicsResource that was created during the lifetime of the application. Using this registration an application can look up any previously created resource (assuming it's not been collected, or disposed) should it be necessary.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |