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 an extension method in c#?
What does void mean in c#?
What are the string functions in c#?
What is datasource c#?
What is difference between a function and a method?
What is the relationship between a process, application domain, and application?
Why do we need indexers in c#?
What is Covariance and contravariance in C#?
How can I create image pieces/sub image?
What is oledb in c#?
Write the difference between TypeOf and GetType?
what are some characteristics of an array?
Explain dataset.acceptchanges method in .net?
What do you mean by casting a data type?
What is executenonquery c#?