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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -