first-class

Are primitive types different in Java and C#?

倖福魔咒の 提交于 2019-12-18 11:52:36
问题 I am manually converting code from Java to C# and struggling with (what I call) primitive types (see, e.g. Do autoboxing and unboxing behave differently in Java and C#). From the answers I understand that double (C#) and Double (C#) are equivalent and double (C#) can also be used in containers, e.g. as a key in a Dictionary. However, double (Java) cannot be used in containers like HashMap which is why it is auto-boxed to Double (Java). Is double (C#) a primitive or an object? If it's a

第一类对象(First-class Object)

这一生的挚爱 提交于 2019-12-09 23:23:58
In programming language design, a first-class citizen (also object, entity, or value) in a given programming language is an entity which supports all the operations generally available to other entities. These operations typically include being passed as a parameter, returned from a function, and assigned to a variable. 第一类对象(First-class Object)在1960年由Christopher Strachey 发明,原来称之为第一类公民(First-class citizen),意思是指函数可以作为电脑中的第一类公民。英文中也称之为First-class entity或First-class value。 定义 第一类对象不一定是指面向对象程序设计中所指的对象,而是指程序中的所有实体 (比如:变量、函数、队列、字典等等)。一般第一类对象具有一下特征: 可以被存入变量或其他结构 可以被作为参数传递给其他方法/函数 可以被作为方法/函数的返回值

Are primitive types different in Java and C#?

五迷三道 提交于 2019-11-30 04:57:34
I am manually converting code from Java to C# and struggling with (what I call) primitive types (see, e.g. Do autoboxing and unboxing behave differently in Java and C# ). From the answers I understand that double (C#) and Double (C#) are equivalent and double (C#) can also be used in containers, e.g. as a key in a Dictionary. However, double (Java) cannot be used in containers like HashMap which is why it is auto-boxed to Double (Java). 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

What are first-class objects in Java and C#?

余生颓废 提交于 2019-11-27 19:41:47
When I started OO programming many years ago I gained the impression that variables (if that is the right word) were either "primitives" (int, double, etc.) or first-class objects (String, JPane, etc.). This is reinforced by a recent answer on primitives in Java and C# (@Daniel Pryden: Are primitive types different in Java and C#? ). However don't know whether C# ValueTypes are primitives, objects or some other beast such as second-class objects. I see that SO has only one use of the first-class tag so maybe it is no longer a useful term. I did not find the Wikipedia article useful ("This

What are first-class objects in Java and C#?

瘦欲@ 提交于 2019-11-26 22:50:54
问题 When I started OO programming many years ago I gained the impression that variables (if that is the right word) were either "primitives" (int, double, etc.) or first-class objects (String, JPane, etc.). This is reinforced by a recent answer on primitives in Java and C# (@Daniel Pryden: Are primitive types different in Java and C#?). However don't know whether C# ValueTypes are primitives, objects or some other beast such as second-class objects. I see that SO has only one use of the first