That’s because you are using the Activator.CreateInstance overload which accepts an object array, which is supposed to contain a list of constructor parameters. In other words, it’s trying to find a StateLog constructor overload which has 16 parameters, instead of one. This compiles due to array covariance.
So when the compiler sees this expression:
Activator.CreateInstance(typeof(T), lines)
since lines is a string[], it presumes you want to rely on covariance to have it cast it to object[] automatically, meaning that the compiler actually sees it like this:
Activator.CreateInstance(typeof(T), (object[])lines)
The method will then try to find a constructor which has a number of parameters equal to lines.Length, all of type string.
For example, if you have these constructors:
class StateLog
{
public StateLog(string[] line) { ... }
public StateLog(string a, string b, string c) { ... }
}
Calling Activator.CreateInstance(typeof(StateLog), new string[] { "a", "b", "c" }) will call the second constructor (the one with three parameters), instead of the first one.
What you actually want is to pass the entire lines array as the first array item, effectively:
var parameters = new object[1];
parameters[0] = lines;
Activator.CreateInstance(typeof(T), parameters)
Of course, you can simply use an inline array initializer:
list.Add((T)Activator.CreateInstance(typeof(T), new object[] { lines }));