The following code:
public interface ISomeData
{
IEnumerable Data { get; }
}
public class MyData : ISomeData
{
private List
What if you accessed your MyData object trough the ISomeData interface? In that case, IEnumerable could be of an underlying type not assignable to a List.
IEnumerable iss = null;
List ss = iss; //compiler error
EDIT:
I understand what you mean from your comments.
Anyway, what I would do in your case would be:
public interface ISomeData where T: IEnumerable
{
T Data { get; }
}
public class MyData : ISomeData>
{
private List m_MyData = new List();
public List Data { get { return m_MyData; } }
}
Converting to generic Interface with appropriate constraint offers I think the best of both flexibility and readability.