Resizing an Array

I have seen people declaring an array of fixed size. But sometimes while working on dynamic elements size this would be capable enough to hold all the elements in the array. But unfortunately it’s not true. Sometimes you need to handle with small set of data and sometimes with big set of data. Then, how to resize the array. So that it would be capable enough to hold this situation.

Simple:
The .NET Framework Version 2.0 introduced a solution to this problem by adding the

Array.Resize method, which is used to change the size of an array.

 Assume that, you have an array named firstArray initialized with five

Elements, you can extend its size to ten elements by using the following

statement:

Array.Resize (ref firstArray, 10);

This is very small method. but, very useful

See the example with the code below.

Thanks,
Md. Jawed

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s