Quale ti piace di più? Classe 1:
public class SearchClass
{
public SearchClass (string ProgramName)
{ /* Searches LocalFile objects, handles exceptions, and puts results into m_Results. */ }
DateTime TimeExecuted;
bool OperationSuccessful;
protected List<LocalFile> m_Results;
public ReadOnlyCollection<LocalFile> Results
{
get { return new ReadOnlyCollection<LocalFile>(m_Results); }
}
#region Results Filters
public DateTime OldestFileModified
{
get { /* Does what it says. */ }
}
public ReadOnlyCollection<LocalFile> ResultsWithoutProcessFiles()
{
return new ReadOnlyCollection<LocalFile> ((from x in m_Results
where x.FileTypeID != FileTypeIDs.ProcessFile
select x).ToList());
}
#endregion
}
Oppure classe # 2:
public class SearchClass
{
public SearchClass (string ProgramName)
{ /* Searches LocalFile objects, handles exceptions, and puts results into m_Results. */ }
DateTime TimeExecuted;
bool OperationSuccessful;
protected List<LocalFile> m_Results;
public ReadOnlyCollection<LocalFile> Results
{
get { return new ReadOnlyCollection<LocalFile>(m_Results); }
}
public class SearchResults : ReadOnlyCollection<LocalFile>
{
public SearchResults(IList<LocalFile> iList) : base(iList) { }
#region Results Filters
public DateTime OldestFileModified
{
get { /* Does what it says. */ }
}
public ReadOnlyCollection<LocalFile> ResultsWithoutProcessFiles()
{
return new ReadOnlyCollection<LocalFile> ((from x in this
where x.FileTypeID != FileTypeIDs.ProcessFile
select x).ToList());
}
#endregion
}
}
... con l'implicazione che OperationSuccessful è accompagnato da una serie di proprietà più interessanti su come l'operazione è andata, e OldestFileModified e ResultsWithoutProcessFiles () hanno anche molti più fratelli nella sezione Filtri risultati.