0

How can I take out one line of this array

  array< array< int^ >^ >^ sample = gcnew array< array< int^ >^ >{
        gcnew array<int>{0, 0, 0, 0, 0},
        gcnew array<int>{1, 1, 1, 1, 1},
        gcnew array<int>{2, 2, 2, 2, 2},
    };

So it would be :-

  array< array< int^ >^ >^ sample = gcnew array< array< int^ >^ >{
        gcnew array<int>{0, 0, 0, 0, 0},
        gcnew array<int>{2, 2, 2, 2, 2},
    };

Rajesh.

2 Answers 2

1

While you can use Array::Resize to resize your array and use the shift method bachchan mentions, you generally don't add or remove items from a C++/CLI array.

If you need add or remove items dynamically from a collection, look into using the System::Collections::Generic::List<T> type (see MSDN).

Depending on what you're doing with the collection, you can use even more sophisticated structures, e.g. HashSet<T> or Dictionary<K, V>.

Sign up to request clarification or add additional context in comments.

Comments

0

for ( i = 0; i < n; i++ ) { if ( a[i] == target ) break; }

while ( ++i < n ) a[i - 1] = a[i]; --n;

The actual process doesn't include a delete step, it's just the shift step:

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.