I'm using C# for developing mobile applications(Monotouch, monodroid). I have a class by this definition:
public class TempIOAddOn : BaseIOAddOn
{
public TempIOAddOn ()
{
}
}
And I use this code to access an instance of class by its string name:
BaseIOAddOn tempIOAddOn;
Type t= Type.GetType("TempIOAddOn" );
tempIOAddOn = (BaseIOAddOn)Activator.CreateInstance(t);
But after executation, t
is null
.
I tried below code also:
BaseIOAddOn tempIOAddOn;
tempIOAddOn = (BaseIOAddOn )System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("TempIOAddOn" );
But again I face with null
. tempIOAddOn
is null
.
What is wrong with me?