Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6360199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:37:06+00:00 2026-05-24T23:37:06+00:00

I was going through the source code for Array.cs when I read that Array.Copy()

  • 0

I was going through the source code for Array.cs when I read that Array.Copy() does not provide a guarantee that a copy would be successful and infact even possibly corrupting the original instance (Correct me if I am wrong here). To provide peace of mind, ConstrainedCopy () seems to achieve the same.

My question is:
1> Why would anyone use Array.Copy() if it doesn’t seem to guarantee a successful transfer of data and going on to possibly hurt the original instance? Infact, all collection classes seem to use Array.Copy() to increase their instance size. Why not use ConstrainedCopy() here

2> How much would be the cost of using ConstrainedCopy () all the time then? I am assuming there would be more logic added to ConstrainedCopy () ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:37:06+00:00Added an answer on May 24, 2026 at 11:37 pm

    ConstraintedCopy() does not guarantee success. The first line of the MSDN Docs states:

    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. Guarantees that all changes are undone if the copy does not succeed completely.

    More specifically the second line :

    Guarantees that all changes are undone if the copy does not succeed
    completely.

    An exception can still be thrown in very extreme circumstances.However those circumstances are exceptional and you shouldn’t have to worry about them in most scenarios.

    In short, just stick with Array.Copy().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm going through the source code of the less unix tool by Mark Nudelman,
I was going through the source code of ArrayList. I came across the method
I was going through the source code of jQuery. I'm having trouble understanding the
I am going through the source code for the above project and I don't
I've been going through some open-source code for a Twitter app, and came across
while going through some of the mili source code I came across a struct
I was going through the Calendar class source code in the Java API, and
I have been going through the docs and source code looking for something without
I was going through someone's .asp code and saw that he was printing a
I've been going through some C source code and I noticed the following: void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.