If I have a generic interface with a couple of implementing classes such as:
public interface IDataElement<T>
{
int DataElement { get; set; }
T Value { get; set; }
}
public class IntegerDataElement : IDataElement<int>
{
public int DataElement { get; set; }
public int Value { get; set; }
}
public class StringDataElement : IDataElement<String>
{
public int DataElement { get; set; }
public String Value { get; set; }
}
Is it possible to pass a collection of the implementing classes of differing types, without having to resort to passing as object.
It does not appear to be possible to define a return values as
public IDataElement<T>[] GetData()
or
public IDataElement<object>[] GetData()
Any suggestions?