java - What is the difference between the terms non-primitive type and object type? -
when read java, see variables described either primitive type or object type.
when read c#, see variables described either primitive type or non-primitive type?
what difference between terms object type , non-primitive type?
part of confusion may in that, in c#, (mostly) inherits object. refer object type in same way, refer every type in language, , useless.
in c#, primitive types boolean, byte, char, double, int16, int32, int64, intptr, sbyte, single, uint16, uint32, uint64, uintptr. these types still inherit object, though treated differently language. there few types don't inherit object, not consider primitives (ie interfaces). list of c# primitives can acquired code, taken here:
var primitives = typeof(int).assembly.gettypes().where(type => type.isprimitive).toarray();
a more appropriate dichotomy, if wanted such thing, value types versus reference types. when begin considering difference, can include things such enum types, , other values type, structs.
Comments
Post a Comment