I\'m trying to override a property in a base class with a different, but derived type with the same name. I think its possible by covarience or generics but am not sure how
Not sure about Generics, but you could achieve a limited effect with simple Polymorphism (assuming SunData inherits from Data etc)
public class Sun : OuterSpace
{
void SomeInitializationMethod()
{
Data = new SunData();
Analysis = new SunAnalysis(); // etc
}
}
// You could also make casting simpler with a generic method on the base
public T GetData()
{
if (Data is T)
{
return Data as T;
}
return null;
};