what is an immediate inheritor of int32 in C#? int or int16
Assuming you're talking about inheritance (it's not terribly clear)...
System.ValueType
, effectively - or nothing, depending on your viewpoint.
Note that int
and System.Int32
are the same type; the first is an alias for the other.
Value types (such as int
) implicitly inherit from System.ValueType
(or System.Enum
) and can't inherit from anything else.
I don't understand the question but int
is just an alias for Int32
so by the process of elimination the answer to your question is probably int16
.
Not sure on the question, but C# has the following datatypes:
System.Int16
(keyword short
can be used), 16bit
System.Int32
(keyword int
can be used), 32bit
They are value types so neither can inherit from anything other than System.ValueType
, there is no inheritance between the two.
The basetype is ValueType
.
Additionally it implements the interfaces IComparable
, IComparable<int>
, IConvertible
, IEquatable<int>
, IFormatable
.
The keyword int
is an alias for System.Int32
. Since System.Int32
is a struct, it has no subtypes. Like all structs, its immediate supertype is System.ValueType
(which itself has supertype System.Object
.)
Int16
(also known by the keyword short
) is also a struct, so has no subtypes, and supertype System.ValueType
. It has no type relation to int
and Int32
.
From MSDN:
All value types implicitly inherit from the class System.ValueType, which, in turn, inherits from class object.
Although I'm not exactly sure if I understood your question well. If you are looking for a child of Int32, I think there is none as indicated here.