Click here to Skip to main content
15,747,169 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one array which store random numbers. If i replace 1 of this number with zero is it possible that can get replaced values without storing it anywhere?

e.g 25-45-67-86-32-65

and now 25-45-67-0-32-65

want to retrieve 86 with using array properties.

What I have tried:

i have tried same thing which is there is datatable(rowdeleted etc.) are present or not in array
Updated 18-Feb-17 19:33pm

How can you remember something if you choose not to remember it? The changed value has to be stored somewhere somehow before it can be recovered, even Windows has that recycle bin. For your question, you could have made a copy of the original array, then the original value of a changed element in the original array can be retrieved from the copied array, e.g.
// Instantiate the source array.
int[] source = new int[5];
source[0] = 1;
source[1] = 2;
source[2] = 3;
source[3] = 4;
source[4] = 5;
// Instantiate and allocate the copy array.
int[] copy = new int[source.Length];
// Copy the source to the copy array.
Array.Copy(source, copy, source.Length);

// change one of the source eleement
source[3] = 0;

// Find the original value of the changed element
for(int i=0; i < copy.Length; i++)
    if(source[i] != copy[i]) Console.WriteLine(copy[i]);
See demo at Array.Copy C#[^]
Share this answer
Finding value inside array without using history

The concept of history in array do not exist.
If you want this feature, I fear you will have to create it.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900