Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Dictionary and Texture2D instances as a key.

$
0
0

@willmotil wrote:

If i were to use Texture2D objects for a key in a dictionary does anyone know if it will reliably avoid collisions at least until the content manager unload call occured?

Or would i have to use a hashcode or create a hashcode function. My concern is only that no collisions occur from the time textures are loaded until the time a unload occurs.

Most of the time i can get around dictionary's and preferably so. Using a private static index reference counter in a constructor and assign it to a instance itself as a id on construction. In that way i have a iteratable list were each instance contains its own unique contiguously ordered key.

In this case however i don't want to change Texture2d internally, my test class is meant to be a external utility class fully decoupled. So making alterations to a source build would defeat the purpose.

Well i don't think it matters i can't seem to directly pass a reference to a dictionary's value.

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles