Possible Duplicate:
How to use reflection to call generic Method?
My actual code looks like this:
Myclass component = go.GetComponent<Myclass>();
I would like to make it more dynamic using reflections, so I tried the following
Type component = Type.GetType("Myclass");
object componentInstance = Activator.CreateInstance(component);
componentInstance = go.GetComponent<component>();
For the last line I get the following error
The type or namespace name 'component' could not be found (are you missing a using directive or an assembly reference?)
Is there way to make this work?