Activator.CreateInstance(string assemblyName,string typName) in silverlight windows phone 7
I want to use Activator.CreateInstance(string assemblyName,string typ开发者_如何学PythonName) (http://msdn.microsoft.com/en-us/library/d133hta4%28v=VS.100%29.aspx) in my Windows Phone 7 app. But it doesn't seems to work.
Any ideas of solutions or work arounds?
You've referenced the .net 4.0 (full framework) in your question. I think you want the Silverlight version: http://msdn.microsoft.com/en-us/library/system.activator.createinstance(v=VS.95).aspx
There isn't a version which matches the signature you're trying to use in Silverlight. You need to pass a Type and, optionally, any parameters the constructor of that type takes.
On the phone you can't load an assembly this way, only a type.
精彩评论