Difference between the System.Array.CopyTo() and System.Array.Clone()

前端 未结 13 2157
攒了一身酷
攒了一身酷 2020-12-02 06:50

What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?

13条回答
  •  生来不讨喜
    2020-12-02 07:23

    The Clone() method don't give reference to the target instance just give you a copy. the CopyTo() method copies the elements into an existing instance.

    Both don't give the reference of the target instance and as many members says they give shallow copy (illusion copy) without reference this is the key.

提交回复
热议问题