1

How can I rewrite all values in array? For example I have array:

 int[] polyX = { -22, 21, 166, 174, 106, 33, 20, 14, -30, -19, -24 };

And now I want to set these values:

polyX = { -43, 5, 23, 65, -64, 33, 4, 14, -30};

Is it possible to set new values to arrays like to any other variable?

5
  • Can you use polyX.ToArray() or is this for a homework problem? Commented Apr 4, 2015 at 14:10
  • I can but im no familiar to that method. Commented Apr 4, 2015 at 14:11
  • take a look to array class documentation: msdn.microsoft.com/en-us/library/… Commented Apr 4, 2015 at 14:13
  • The second set of values are identical to the first. What exactly are you trying to do? Commented Apr 4, 2015 at 14:15
  • I could create different array variable but it would take more time since I would need about 100 of them. Commented Apr 4, 2015 at 14:19

1 Answer 1

1

There's a syntax error in your second line. It should actually be:

polyX = new[] { -43, 5, 23, 65, -64, 33, 4, 14, -30, -3, -321};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.