Geeks With Blogs
Abhishek Anand Bits & Bytes about .net technology framework. collections
Usage of Arrays
Although both arrays and collections are used in a similar fashion, there are some performance considerations when choosing one over the other. Below are some design guidelines: 1- You should not return an internal instance of an array. This allows calling code to change the array. The following example demonstrates how the array delimiters can be altered by the calling code. public sealed class DocParser { private DocParser(){} private static char[] delimiters = {',', '-', ' '} public char[] Delimiters ......

Posted On Wednesday, November 20, 2013 4:29 PM

Collection Optimizations
Array Vs. ListDevelopers use arrays when their collection has a fixed length, and lists when they do notIt is always more efficient to use arrays over lists whenever possible.Underneath the hood most collections use arrays in their implementation, but it is still better to default to using an array. If the case arises in development that requires a variable size collection, List would be a good choice.List Vs. ArrayListUnlike List<T>, ArrayList is not a generic collection which means it stores ......

Posted On Monday, October 21, 2013 5:10 PM

Copyright © Abhishek Anand | Powered by: