zoukankan      html  css  js  c++  java
  • What is the difference between Array.Clone and Array.Copy Method

    Array.Clone Method:

    1).Creates a shallow copy of the Array.

    --------------------------------------------------------------------------------------------------------------------------------

    2). Remarks

    A shallow copy of an Array copies only the elements of the Array, whether they are reference types or value types, but it does not copy the objects that the references refer to. The references in the new Array point to the same objects that the references in the original Array point to.

    In contrast, a deep copy of an Array copies the elements and everything directly or indirectly referenced by the elements.

    The clone is of the same Type as the original Array.

    This method is an O(n) operation, where n is Length

    ---------------------------------------------------------------------------------------------------------------------------------Array.Copy Method  

    1 ). Copies a range of elements in one Array to another Array and performs type casting and boxing as required.

    2).  This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

    Overload List


      Name Description
    Public methodStatic member Copy(Array, Array, Int32) Copies a range of elements from an Array starting at the first element and pastes them into another Array starting at the first element. The length is specified as a 32-bit integer.
    Public methodStatic member Copy(Array, Array, Int64) Copies a range of elements from an Array starting at the first element and pastes them into another Array starting at the first element. The length is specified as a 64-bit integer.
    Public methodStatic member Copy(Array, Int32, Array, Int32, Int32) Copies a range of elements from an Array starting at the specified source index and pastes them to another Array starting at the specified destination index. The length and the indexes are specified as 32-bit integers.
    Public methodStatic member Copy(Array, Int64, Array, Int64, Int64) Copies a range of elements from an Array starting at the specified source index and pastes them to another Array starting at the specified destination index. The length and the indexes are specified as 64-bit integers.

    做个快乐的自己。
  • 相关阅读:
    Mysql数据库的安装及配置
    java调用ws服务
    linux下安装mysql
    实现离线地图行政区域划分
    linux远程方式,以及基础命令
    javascript对文件的读写
    jsoup对 HTML 文档的解析和操作
    Linux netstat命令详解
    服务器开发工具
    github基本命令
  • 原文地址:https://www.cnblogs.com/Jessy/p/1860603.html
Copyright © 2011-2022 走看看