The new operator is used to create new instances of types.
There are three forms of new expressions:
?Object creation expressions are used to create new instances of class
types and value types.
?Array creation expressions are used to create new instances of array types.
?Delegate creation expressions are used to create new instances of delegate
types.
The new operator implies creation of an instance of a type, but does not
necessarily imply dynamic
allocation of memory. In particular, instances of value types require no
additional memory beyond the
variables in which they reside, and no dynamic allocations occur when new
is used to create instances of
value types.
There are three forms of new expressions:
?Object creation expressions are used to create new instances of class
types and value types.
?Array creation expressions are used to create new instances of array types.
?Delegate creation expressions are used to create new instances of delegate
types.
The new operator implies creation of an instance of a type, but does not
necessarily imply dynamic
allocation of memory. In particular, instances of value types require no
additional memory beyond the
variables in which they reside, and no dynamic allocations occur when new
is used to create instances of
value types.
本文详细介绍了C#中的new操作符用法及其三种表达形式:对象创建表达式、数组创建表达式及委托创建表达式。此外还讨论了new操作符在值类型实例化过程中的内存分配特点。
743

被折叠的 条评论
为什么被折叠?



