110,534
社区成员
发帖
与我相关
我的任务
分享
public partial class Route : Form
{
public List<string> picCount = new List<string>();
public Route(string statusInfo)
{
InitializeComponent();
this.listBox1.Focus();
this.statusInfo = statusInfo;
}
}
public class ThreadWithState
{
public void ThreadProc()
{
//这边报错, 没用0个参数
Route r = new Route("");
//请问这边该怎么改?
r.picCount...
}
}
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Route());
}
}
方法二:
public partial class Route : Form
{
public List<string> picCount = new List<string>();
public Route(string statusInfo)
{
InitializeComponent();
this.listBox1.Focus();
this.statusInfo = statusInfo;
}
}
public class ThreadWithState
{
public void ThreadProc()
{
//这边报错, 没用0个参数
Route r = new Route("");
//请问这边该怎么改?
r.picCount...
}
}
类Route中没有默认的构造函数引起的,只要添加默认的构造函数就可以了。
public class Post
{
public Post(int Id,string title)
{
this.ID = Id;
this.Title = title;
}
public int ID { get; set; }
public int CategoryID { get; set; }
public string Title { get; set; }
public string Summary { get; set; }
public string Alias { get; set; }
public string Content { get; set; }
public DateTime CreateTime { get; set; }
public Category Category { get; set; }
public ICollection<Tag> Tags { get; set; }
public ICollection<Comment> Coments { get; set; }
}
Post post=new Post(1,"title")
public Post(int Id,string title)
{
this.ID = Id;
this.Title = title;
}
public int ID { get; set; }
public int CategoryID { get; set; }
public string Title { get; set; }
public string Summary { get; set; }
public string Alias { get; set; }
public string Content { get; set; }
public DateTime CreateTime { get; set; }
public Category Category { get; set; }
public ICollection<Tag> Tags { get; set; }
public ICollection<Comment> Coments { get; set; }
}
Post post=new Post(1,"title")