You could create a static class with a generic method to create the objects. It assumes that all the constructors are the same, which in this case won't be a problem.
public static class Wrapper
{
public static T CreateA<T>(double[] a) where T : TheOriginalClasses.A
{
Type[] types = new Type[1];
types[0] = typeof(List<double>);
ConstructorInfo constructorInfo = typeof(T).GetConstructor(types);
object[] objects = new object[1];
objects[0] = a.ToList();
T value = constructorInfo.Invoke(objects) as T;
return value;
}
}
You can call this which the following code:
double[] a = new double[3] { 0.5, 1.1, 2.5 };
var testA = Wrapper.CreateA<TheOriginalClasses.A>(a);
var testA1 = Wrapper.CreateA<TheOriginalClasses.A1>(a);
var testA2 = Wrapper.CreateA<TheOriginalClasses.A2>(a);
Console.WriteLine(testA.GetType().ToString());
Console.WriteLine(testA1.GetType().ToString());
Console.WriteLine(testA2.GetType().ToString());
I'm not sure if this code will win a code beauty contest, but it will give you a generic wrapper. A disadvantage might be performance loss due to using Reflection.