温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:多层文章管理系统源码
当前文件:
MultiLayerArticle/Model/ArticleCollection.cs,打开代码结构图
MultiLayerArticle/Model/ArticleCollection.cs,打开代码结构图1using System; 2
using System.Collections.Generic; 3
using System.Text; 4
using System.Collections; 5
6
namespace Model 7
{ 8
public class ArticleCollection : CollectionBase 9
{ 10
private int articleCount; 11
/// <summary> 12
/// 文章数量 13
/// </summary> 14
public int ArticleCount 15
{ 16
get { return articleCount; } 17
set { articleCount = value; } 18
} 19
20
public ArticleModel this[int index] 21
{ 22
set { List[index] = value; } 23
get { return (ArticleModel)List[index]; } 24
} 25
26
public void Add(ArticleModel article) 27
{ 28
List.Add(article); 29
} 30
31
public ArticleModel GetArticleModelByArticleID(int articleID) 32
{ 33
ArticleModel article = new ArticleModel(); 34
foreach (ArticleModel am in List) 35
{ 36
if (am.ArticleID == articleID) 37
{ 38
article = am; 39
} 40
} 41
return article; 42
} 43
} 44
} 45





}