Báo cáo kiểm tra và kiểm soát kiểm soát bối cảnh tràn kiểm tra các phép tính số học không tách rời và chuyển đổi loại. Các báo cáo này đã được bao gồm trong Chương 5. Báo cáo khóa delimits một tuyên bố được nhúng vào như là một phần quan trọng loại trừ lẫn nhau, | 170 Chapter 8 Collections and Generics void Remove object value void RemoveAt int index The property IsFixedSize returns true if a collection derived from IList has a fixed size. Otherwise it returns false. Similarly the IsReadOnly property returns true if the collection is read-only. Otherwise it returns false. The indexer this int index gets and sets an item at a specified index. The methods Add Clear and Contains add an item to the collection remove all items from the collection and determine whether the collection contains a specific value. The method IndexOf simply returns the index of a specific item in the collection whereas the method Insert places an item in the collection at a specified location. Finally the methods Remove and RemoveAt delete the first occurrence of a specific value and delete the item at a specified index respectively. Constructors Like all classes instances of collections are created using constructors. Concrete collections have several constructors that typically fall into one of the following categories Without parameters default with a collection to be added or with an initial capacity of items. The constructors for the BitArray ArrayList Stack and Queue collections are given below. The constructors for Hashtable and SortedList follow in Section . BitArray int n bool v Constructor that initializes n bits each to boolean value v. BitArray BitArray BitArray bool BitArray byte BitArray int Copy constructor from a specific BitArray. Copy constructor from a specific array of booleans. Copy constructor from a specific array of bytes. Copy constructor from a specific array of integers. ArrayList ArrayList ICollection ArrayList int Default constructor with initial capacity 16. Copy constructor from a specific collection. Constructor with a specific initial capacity. Stack Stack ICollection Stack int Default constructor with initial capacity 10. Copy constructor from a specific collection. Constructor with a specific initial capacity. .