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
Can we make a Static Constructor Parameterized? Give Reason with your answer
What are modifiers in c#?
What type of data type conversion happens when the compiler encounters the following code?
How jit (just in time) works?
What is the task perform by clr?
What is the difference between ienumerable and iqueryable?
What does convert toint32 mean?
what is the difference between a struct and a class in c#?
Can non-default constructors be used with single call sao?
What is the difference between field and variable in c#?
How do I format a string in c#?
What is an xsd file?
Is object an int c#?
Is lazy t thread safe?
What is lastindexof c#?