im trying to move code from java to c# and i got problem with code syntax.
because in c# dont exist Class<?>
and i need to call newInstance()
inside Class<?>
in java i have:
private final Map< String, Class< ? extends AbstractAI>> aiMap = new HashMap< String, Class< ? extends AbstractAI>>(); //line code i need to move
public final AI2 setupAI(String name, Creature owner) {
AbstractAI aiInstance = null;
try {
aiInstance = aiMap.get(name).newInstance();//line code i need to move
}
catch (Exception e) {
log.error("[AI2] AI factory error: " + name, e);
}
return aiInstance;
}
if you know solution please help me move this java code into c#. Thanks