The following code doesn't compile in a Windows 10 Universal App, but does in a .Net console app (both using Reflection):
string objType = "MyObjType";
var a = Assembly.GetExecutingAssembly();
var newObj = a.CreateInstance(objType);
It would appear that universal windows apps don't contain the method Assembly.GetExecutingAssembly()
; nor do the Assembly objects seem to contain CreateInstance
.
Activator.CreateInstance has 16 overloads in .Net and only 3 in A Win 10 app. I'm referencing the desktop extensions.
Is this type of construct still possible in Windows 10 and, if so, how? What I'm trying to do is to create an instance of a class from a string representing that class.