Gorgon
Show / Hide Table of Contents

Class GorgonResourceLocator

A locator extension for GorgonGraphicsResource objects.

Inheritance
object
GorgonResourceLocator
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Gorgon.Graphics.Core
Assembly: Gorgon.Graphics.Core.dll
Syntax
public static class GorgonResourceLocator

Methods

| Edit this page View Source

LocateResourcesByName<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 graphics parameter is null.

See Also
GorgonGraphicsResource
| Edit this page View Source

LocateResourcesByType<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 graphics parameter is null.

See Also
GorgonGraphicsResource
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author