namespace News_Articles.Data { /// /// Summary description for Article. /// public class Article { private int _id; //文章编号 private string _author; //文章的作者 private string _topic; //文章的标题 private DateTime _postTime; //文章的发表时间 private string _content; //文章内容
public int ID { get { return _id;} set { _id = value;} } public string Author { get { return _author; } set { _author = value; } } public string Topic { get { return _topic; } set { _topic = value; } } public string Content { get { return _content; } set { _content = value; } } public DateTime PostTime { get { return _postTime; } set { _postTime = value; } } } }
然后我们写一个文章集合类 ArticleCollection 代码如下
程序代码
//ArticleCollection.cs using System; using System.Collections;
namespace News_Articles.Data { /// /// 文章的集合类,继承于 ArrayList /// public class ArticleCollection : ArrayList { public ArticleCollection() : base() { }
public ArticleCollection(ICollection c) : base(c) { } } }