Generics and polymorphism are two orthogonal concepts.
You try to use polymorphism where you have generic classes.
E.g. x.value is obviously not polymorphic since it has separate implementations depending on some generic types.
If you can afford to loose compile time type checks and are willing to pay the runtime overhead for reflection and if you are also willing to handle linking exceptions at runtime, then you could define x as dynamic and the list as List<dynamic>.
I would generally not advise that, though.
You should decide if you need polymorphism or if you need generics, but not both for your problem at hand.
If you want to have generics mixed with polymorphism, then for polymorphic access, you must only employ
methods without generic types and
no generic properties.
Andi
Edited Answer:
Example code that might show how you may employ extension methods for a kind of interface methods with generics. As you can see, polymorphism is broken since you need to know the type of the polymorphic object:
public static class Extension
{
public static bool Is<T>(this IBase obj) { return obj is Base<T>; }
public static Base<T> As<T>(this IBase obj) { return (Base<T>)obj; }
}
public interface IBase
{
}
public class Base<T> : IBase
{
public T Value { get; set; }
}
public class StrBase : Base<string>
{
}
public class IntBase : Base<int>
{
}
class Program
{
static void Main(string[] args)
{
{
StrBase sb = new StrBase();
sb.Value = "abc";
string s = sb.Value;
}
{
IntBase ib = new IntBase();
ib.Value = 123;
int i = ib.Value;
}
{
IBase obj = new IntBase();
obj.As<int>().Value = 234;
int i = obj.As<int>().Value;
}
{
List<IBase> list = new List<IBase>();
list.Add(new IntBase());
list[0].As<int>().Value = 123;
int i = list[0].As<int>().Value;
}
}
}