General concepts about collections
1. What is the main advantage of the collections?
Collections standardizes the handling of groups of objects in the program. Under the standardized processing means the use of such well-known dynamic data structures such as stacks, queues, linear lists, hash tables. In addition, in the collections is ensured the dissemination of data processing operations, such as sorting.
All collections are implemented on the basis of well-defined interfaces.
2. What types of collections are supported by .NET 4.0 (C#)?
In the .NET Framework 4.0 is supported 5 types of collections:
– not-generalized collections;
– specialized collections;
– bit arrays collections;
– generalized collections;
– parallel (multi-threaded) collections.
3. What types of data are operated by the not-generalized collections?
Not-generalized collections can operate by data of any type. It means, these collections operate with data of type object.
In addition, in not-generalized collections is allowed to have the data of different types.
4. In what namespace not-generalized collections are included?
To include not-generalized collection in program text, must be specify:
5. What the main data structures are realized in not-generalized collections?
– dynamic array;
6. What types of data are realized in special collections?
Special collections operate a specific type of data.
For example, in the some special collections:
– “StringCollection” class is optimized to work with collections of character strings;
– “StringDictionary” class is intended for processing hash tables, in which are stored the pair “key-value“, and the key type and value is the string.
7. In what namespace are defined special collections?
In the namespace
To include the special collections in the program, you need enter:
8. What collections of the bitwise organization are implemented in the .NET Framework?
Answer: collection of BitArray type. This collection supports an operations on separate bits. These operations can be logical “AND“, logical “OR“, logical “NOT” and logical “XOR“.
9. In what namespace the collection BitArray with bitwise organization is declared?
10. What the standard structures of data are realized in generalized collections?
Answer: linked lists, stacks, queues, dictionaries.
11. What is the feature of parallel (multithreaded) collections?
Parallel (multithreaded) collections provide a multithreaded access to the collection. These collections are thread safe and are using methods of parallel programming. It means, these collections provide the safe operation of the program, if possible access to a collection of two or more concurrent threads.
12. In what namespace are declared the parallel collections?
In the namespace
To work with parallel collections, you need to enter in the program code the following string: