I am manually converting code from Java to C# and struggling with (what I call) primitive types (see, e.g. http://stackoverflow.com/questions/1597154/do-autoboxing-and-unboxing-behave-differently-in-java-and-c). From the answers I understand that double
(C#) and Double
(C#) are equivalent. double
(C#) can also be used in containers, e.g. as a key in a Dictionary (whereas double
(Java) cannot).
- Is
double
(C#) a primitive or an object? - If it's a primitive what makes it behave differently from
double
(Java)?
double
(C#) cannot be set to null unless it is made nullable
.
- Is
double?
(C#) equivalent toDouble
(Java)? Are they both referred to as objects?
(Is the use of the term "first-class object" useful in this discussion?)