Hey guys,
I am currently writing a resource manager for my game. This is basically a class that will handle all kinds of other objects of different types, and each object is referred to by name (a System.String). Now this is my current implementation, but since I am using a dictionary of objects I will still need to cast every object. Is there a way to use Generics in this case? I'm not very strong on those, I tried reading up on them and it just ended up confusing me more.
public static class ResourceManager
{
public static Dictionary<string, object> Resources { get; private set; }
public static void LoadResources()
{
Resources = new Dictionary<string, object>();
//Sample resource loading code
Resources.Add("number", 3);
Resources.Add("string", "bleh");
Console.Log("Loaded " + Resources.Count + " resources.");
}
}