Did it possible to cast a generic type of derived class to
generic type of base class?
Answer Posted / lalit pradhan
Good explaination Karthikeyant :)
Also in addition to that the following cast is also not
possible. It will compile but give you casting error on
compile time.
DerivedClassGenrics<int> derivedClassGenrics = new
DerivedClassGenrics<int>();
BaseClassGenrics<int> baseClassGenrics = new
BaseClassGenrics<int>();
derivedClassGenrics = (DerivedClassGenrics<int>)
baseClassGenrics;
Enjoy!!!
Lalit Pradhan a.k.a DOTNET Gadha
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is property in c#?
What exactly happens when we debug and build the program?
How do I do implement a trace?
Explain async and await?
What is global namespace in c#?
What is an enumerator c#?
What is difference between list and dictionary in c#?
Can we change static variable value in c#?
How can I check the type of an object at runtime?
What is difference between array and arraylist in c#?
Why dictionary is faster than list?
How do I use the 'using' keyword with multiple objects?
Why do we use lambda expression in c#?
How do you prevent a method from being overridden in c#?
What does typeof return c#?