In .NET, all value types inherit from the class named System.ValueType. System.ValueType is a class, so it is a reference type.
My question is how and why possible a value type derives from a reference type?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The following is the key paragraph in the documentation
The inheritance occurs when the compiler compiles the overriden virtual methods of
System.Object. TheSystem.ValueTypeclass simply provides more appropriate overloads ofToString(),GetHashCode()etc. As the document states the compiler uses these overloads if thestructkeyword is used (in C#). This tells the compiler use theSystem.ValueTypemethods instead of theSystem.Objectmethods.