- Clone the old array into the new array (un-necessary overhead)
- Just proceed with a array with redundant trailing allocated memory
- You can resize it with Array.Resize(ref <arrayName>, int newArraySize)
int[] myArray = new int[50];
int newArrayCount = 0;
//some biz logic goes here
//determined array size
newArrayCount = myArray.Count;
Array.Resize(ref myArray, newArrayCount);
You can put myArray.Count as the 2nd parameter of the resizing method, up to your preference.
reading ur articles is like reading a book with tips and tricks. However as a whole, it's not cohesive and every topics are like randomly generated.
ReplyDeletethanks for your comments, i'm very new to blogging technical stuff. I'm figuring out a way to group all my topics into a more user-friendly way. I will try to improve the content along the way.
ReplyDelete