Содержание
- 2. Agenda Array System.Collections Hashtables Stack, Queue SortedList Collection Interfaces System.Collections.Generic List
- 3. Array is a data structure that contains several variables of the same type. type [ ]
- 4. int[] a = new int[5]; int [,] myMatrix=new int [6,8]; a[0] = 17; a[1] = 32;
- 5. Multidimensional arrays: string [ , ] names = new string[5,4]; Array-of-arrays (jagged): byte [ ][ ]
- 6. Array. Benefits. Limitations Benefits of Arrays: Easy to use: arrays are used in almost every programming
- 7. System.Collections. ArrayList System.Collections namespace ArrayList, HashTable, SortedList, Queue, Stack: A collection can contain an unspecified number
- 8. ArrayList is a special array that provides us with some functionality over and above that of
- 9. ArrayList services public class ArrayList : IList, ICloneable { int Add (object value) // at the
- 10. ArrayList. Benefits and Limitation Benefits of ArrayList: Supports automatic resizing. Inserts elements: An ArrayList starts with
- 11. Stack Stack: last-in-first-out
- 12. Queue Queue: first-in-first-out using System.Collections; class Watcher { Queue events = new Queue(); ... } create
- 13. Hashtable Represents a collection of key/value pairs that are organized based on the hash code of
- 14. Hashtable Limitations of Hashtable: Performance and speed: Hashtable objects are slower to update but faster to
- 15. SortedList Represents a collection of key/value pairs that are sorted by the keys Are accessible by
- 16. [SerializableAttribute] [ComVisibleAttribute(true)] public class SortedList : IDictionary, ICollection, IEnumerable, ICloneable {…} SortedList
- 17. Collections. Drawbacks No type checking enforcement at compile time Doesn’t prevent adding unwanted types Can lead
- 18. System.Collections.Generic Open constructed types Classes defined without a specific type Type is specified when instantiated Provides
- 19. List List generic class: [SerializableAttribute] public class List : IList , ICollection , IEnumerable , IList,
- 20. Methods such as BinarySearch and Sort use an ordering comparer for the list elements. The List
- 21. using System; using System.Collections.Generic; public class Example { public static void Main() { List dinosaurs =
- 23. Скачать презентацию