Reasonably new to C# here, and was wondering if you could point out what I'm doing wrong here :
class ObjectManager
{
public ObjectInstance GetObject<ObjectInstance>( int objectId )
{
if( m_objects.ContainsKey(typeof(ObjectInsance) )
{
List<EngineObject> objectList = m_objects[typeof(ObjectInstance)];
// This doesn't compile
EngineObject obj = objectList.Find( i => i.ID == objectId );
}
}
...
Dictionary<Type, List<EngineObject>> m_objects;
}
I'm trying to return an EngineObject instance given an ID. EngineObject contains the ID property, but compiling generates the following error :
Error 2 'System.Collections.Generic.List<Engine.Objects.EngineObject>' does not contain a definition for 'Find' and no extension method 'Find' accepting a first argument of type 'System.Collections.Generic.List<Engine.Objects.EngineObject>' could be found (are you missing a using directive or an assembly reference?) C:\Code\Outskirts\Engine\Managers\ObjectManager.cs 64
Any ideas what I'm doing wrong here?