I thought that in .NET types are either value types or reference types. But this guy, when asked about .NET types, talked about “primitive types” and “complex types”.
I understand that people sometimes use different names to refer to the same concepts, but isn’t it strange that a Microsoft certified professional would use this kind of terminology?
2
It’s not strange at all. “Primitives” is a bit of standard terminology in the programming world. It means a thing that is not built out of simpler things, but serves as a building block to create more complex things. So “primitive types and complex types” is a completely valid way to talk about them.
It can be used in other contexts as well. For example, synchronization primitives are low-level constructs that are not actually primitive data types, but are still not built out of other synchronization objects, and can be used to build higher-level synchronization objects, such as monitors.
First of all: I think this might just be confusing terminology.
Primitive types, value types and reference types are 3 different things:
- Primitive types are those that are built into the language as a primitive. (int, bool and so on). MSDN often refers to them as just “built in types”.
- Value types are those that are allocated by value on the stack. They include most of the primitive types. The formal definition is all types that derive from System.ValueType; this also includes all structs.
- Reference types are allocated on the heap and variables of that type are said to be references to the object. It’s like pointers from C, but C# takes care of all the type and memory safety for you.
While I haven’t seen any formal definition for a “complex type” in C#, I would guess it means all defined types that are not primitives. This includes both value types and reference types.
See more info on types on MSDN.
3