Incorrect - value types are objects, they are just objects stored on the stack instead of the heap. So NullableValueType and System.Object. There is Magic in the C# compiler that makes nullable types behave the same way as reference types with regards to null and?
, but they always have copy-by-value semantics.
Incorrect - value types are objects, they are just objects stored on the stack instead of the heap. So, Nullable (which is what T? Is) is a struct, and so inherits from System.
ValueType and System.Object. There is Magic in the C# compiler that makes nullable types behave the same way as reference types with regards to null and? , but they always have copy-by-value semantics.
Thank you. I most likely misread the information (and may have been misinformed). – Norla Dec 4 '09 at 22:58 1 Value types are not "just objects stored on the stack instead of the heap".
Maybe they're usually stored on the stack, but not always, and it's certainly not this that distinguishes value types from ref types. – LukeH Dec 4 '09 at 23:43 Yes, value types can be boxed and can be in a class (and so on the heap inside a ref class instance), but that is the easiest way to think about and to communicate how they behave. – thecoop Dec 5 '09 at 0:17 1 The point is that the behaviour of value types is completely unrelated to how/where they're stored.
After all, the semantics don't change depending on whether they're stored on the stack or the heap, do they? – LukeH Dec 5 '09 at 0:33.
Are you asking about "inheriting from System. Object" or "reference types"? Value types do inherit from System.
Object, but they're not reference types. Nullable types are also value types, so they are not reference types either, but they do inherit from System.Object. Note that there is a difference in what you as the programmer can declare and what the system provides.
Value types do inherit from System. Object, but you cannot yourself declare value types to descend from anything. Value types descend from System.
ValueType, which in turn descends from System.Object. So technically, all value types descend from System.Object.
Nullable types are structs (according to thecoop) and cannot inherit from anything. – RCIX Dec 4 '09 at 23:30 1 Technically they do. Check stackoverflow.Com/questions/1793357/… – Lasse V.
Karlsen? Dec 4 '09 at 23:55 2 Also see blogs.msdn.Com/ericlippert/archive/2009/08/06/… – Lasse V. Karlsen?
Dec 4 '09 at 23:58 @RCIX: I did not say that.To quote - '...and so inherits from System. ValueType and System. Object' – thecoop Dec 4 '09 at 0:15.
Everything is an object, value types are just structs rather classes.
1 Actually, pointer types aren't objects - see blogs.msdn. Com/ericlippert/archive/2009/08/06/… – thecoop Dec 4 '09 at 23:00.
Value types do inherit from System. Object, but they're not reference types. Nullable types are also value types, so they are not reference types either, but they do inherit from System.Object.
Note that there is a difference in what you as the programmer can declare and what the system provides. Value types do inherit from System. Object, but you cannot yourself declare value types to descend from anything.
Value types descend from System. ValueType, which in turn descends from System.Object. So technically, all value types descend from System.Object.
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.