var classes = new[]
{
new
{
Name = "System.String",
AssemblyName = "mscorlib",
Args = new object[] { "Single argument".ToCharArray() }
},
new
{
Name = "Newtonsoft.Json.Linq.JObject",
AssemblyName = "Newtonsoft.Json",
Args = new object[] {}
},
new
{
Name = "System.IO.FileInfo",
AssemblyName = "mscorlib",
Args = new object[] { @"C:\Windows\System32\cmd.exe" }
}
};
var instances = classes
.Select(i =>
{
var assembly = Assembly.Load(i.AssemblyName);
var type = assembly.GetType(i.Name);
var instance = Activator.CreateInstance(type, i.Args);
return instance;
})
.ToArray();