-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List Bug Fix #1241 #1247
List Bug Fix #1241 #1247
Conversation
- Fixed Explorer tool / Emit binary
- Fixed Explorer tool / Emit binary
@@ -345,11 +345,11 @@ public void Insert(int index, T item) | |||
{ | |||
EnsureCapacity(_size + 1); | |||
|
|||
_size++; | |||
for (int i = index; i < _size; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loop should start from the end and work backwards, otherwise it is overwriting as it moved forwards.
e.g.
[5, 6, 7]
Insert 9 at index 1
After first loop iteration: [5, 6, 6, 0]
After second loop iteration: [5, 6, 6, 6]
After final assignment at desired index: [5, 9, 6, 6]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
No description provided.