Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.
class Article()
{
string article {get; set;}
bool isFiltered {get;set}
}
var myArticlesList = new List<Article>();
public class Article
{
private System.String _article;
private System.Boolean _filtered;
public System.String Article
{
get { return this._article; }
set { this._article = value; }
}
public System.Boolean IsFiltered
{
get { return this._filtered; }
set { this._filtered = value; }
}
}
public class ArticleCollection : System.Collections.Generic.List<Article>
{
// Call base constructors so your class will basically be identical to the List<Article> class
public ArticleCollection()
: base() // Unnecessary, but clarity is always good
{}
public ArticleCollection(System.Int32 capacity)
: base(capacity)
{}
public ArticleCollection(System.Collections.Generic.IEnumerable<Article> collection)
: base(collection)
{}
// Not required, but this is a prime case for iterators. Figured I'd include one for you :)
public System.Collections.Generic.IEnumerable<System.String> GetTitles()
{
foreach(Article art in this)
{
yield return art.Article;
}
}
// Add whatever more functionality you need
}
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Join the community of 500,000 technology professionals and ask your questions.