Answer the question
In order to leave comments, you need to log in
How to write wrapper classes over collections in c# so that access to the collection is by class name?
Hello,
Let's say there is a Prices class, inside of which one collection with price history is encapsulated
public class Record
{
public DateTime Date { get; set; }
public MenuTypeEnum MenuType { get; set; }
public decimal? Price { get; set; }
}
public class Prices
{
public Record[] Records { get; private set; }
public Record GetCurrentVersion()
{
return this.Records.OrderByDescending(x=>x.Date).FirstOrDefault();
}
}
var price = new Prices { /передаём коллекцию/ };
var historyCount = price.Records.Count();
var price = new Prices { /передаём коллекцию/ };
var historyCount = price.Count();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question