C#.NET Generic Methods and Inheritance?

The type parameter should be declared with the type, and the subclass will declare the specific type in its inheritance declaration: public abstract class A { public abstract T MethodB(string s); } public class C: A { public override DateTime MethodB(string s) { ... } }.

Cool that works thanks. – eaglestorm May 20 '10 at 2:16.

No. The reason is that you would be providing implementation only for one special case. The base class requires you to implement a MethodB that can work for any type T.

If you implement it only for DateTime and if someone calls, for example, ((A)obj). MethodB then you don't have any implementation that could be used!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions