what is the use System.ValueType and System.Int32 ?? How come System.ValueType is a class whereas System.Int32 is structure ???
Loading
what is the use System.ValueType and System.Int32 ?? How come System.ValueType is a class whereas System.Int32 is structure ???
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted May 26, 2013, 4:36 PM
Enums inherit from System.Enum which in turn inherits from System.ValueType.
The purpose of System.ValueType is to override all the virtual methods in System.Object to provide implementations which are more appropriate for value types as opposed to reference types.
System.ValueType is also useful as a method parameter type if you want to be able to pass any value type to a method for some reason.
As structures are implicitly sealed and so can't be inherited from, System.ValueType needs to be a class rather than a structure.
System.Int32 represents a signed 4 byte integer with a range of approximately plus or minus 2 billion. 'int' is just an alias in C# for this type.