• 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.

    做个快乐的自己。
  • 相关阅读:
    Windows桌面开发之窗口
    imes系统完善
    Dos.ORM简单说明
    C# 调用C++ dll的方法
    Windows10内置Linux子系统(WSL)Vmmem内存占用过大问题
    Docker 常用命令
    Typora 激活
    C# LINQ去重
    Windows10内置Linux子系统(WSL)映射本地盘符
    00-mORMot安装
  • 原文地址:https://www.cnblogs.com/Jessy/p/1860603.html
Copyright © 2020-2023  润新知