日期:2014-05-17  浏览次数:20845 次

C#中调用带参数的类
 
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...
        }
    }


求解决方法
------解决方案--------------------
引用
带参数的类

真能想

那分明是构造函数



   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 void fangfa() ; 
public gouzao();

你那是构造。
------解决方案--------------------