Tag: 函数 exception

找不到类型的构造函数

exception消息: Constructor on type StateLog not found 。 我有以下代码,不适用于只有一个类: List list = new List(); string line; string[] lines; HttpWebResponse resp = (HttpWebResponse)HttpWebRequest.Create(requestURL).GetResponse(); using (var reader = new StreamReader(resp.GetResponseStream())) { while ((line = reader.ReadLine()) != null) { lines = line.Split(splitParams); list.Add((T)Activator.CreateInstance(typeof(T), lines)); } } 它不起作用的类的构造函数与其工作的其他类完全相同。 唯一的区别是这个类将传递16个参数而不是2-5。 构造函数看起来像这样: public StateLog(string[] line) { try { SessionID = long.Parse(line[0]); […]