Collections - String

Regular Expression (System.Text.RegularExpressions) String Format StringBuilder (tự xem thêm)

ppt23 trang | Chia sẻ: tuanhd28 | Lượt xem: 1591 | Lượt tải: 0download
Bạn đang xem trước 20 trang tài liệu Collections - String, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
Collections - String Nội dungSystem.Collections NamespaceArrayList ClassSortedList ClassStringCollectionsTương tự ArrayLà tập hợp các đối tượng có thể gom nhóm lại với nhau.Số lượng các phần tử có thể thay đổi trong thời gian thực thi chương trìnhCác phần tử trong Collection không nhất thiết phải cùng kiểu dữ liệuCollection có các thuộc tính và phương thức hỗ trợ thao tác, xử lý trên các phần tử trong tập hợp.System.Collections NamespaceLà nơi chứa các lớp, giao diện định nghĩa sẵn các đối tượng Collection khác nhau.ArrayList ClassSố phần tử trong ArrayList có thể thay đổi tùy ýCó thể lưu trữ các phần tử khác kiểu dữ liệuCho phép định nghĩa khả năng lưu trữ các phần tử trong ArrayListCác phần tử có thể chứa giá trị null và có thể trùngTruy cập các phần tử trong ArrayList thông qua chỉ số Index.ArrayList ClassConstructors:ArrayList()ArrayList(Icollection)ArrayList(int)ArrayList ClassMethods:Add(Object)Remove(Object)RemoveAt(int)Insert()Contains()CopyTo()IndexOf()ToArray()TrimToSize()ArrayList ClassProperties:Capacity Count Item Ví dụ ArrayList Ví dụ ArrayListVí dụ ArrayList Ví dụ ArrayList SortedList ClassLà một Collection mà mỗi phần tử gồm 2 thành phần: Key và ValueSortedList được sắp xếp bởi thành phần KeyMỗi phần tử được truy cập bởi thành phần Key hoặc chỉ số (Index)SortedList ClassLà một Collection mà mỗi phần tử gồm 2 thành phần: Key và ValueSortedList được sắp xếp bởi thành phần KeyMỗi phần tử được truy cập bởi thành phần Key hoặc chỉ số (Index)SortedList ClassConstructors:SortedList()SortedList(IComparer)SortedList(IDictionary)SortedList(int)SortedList ClassMethods:AddClearCloneContainsContainsKeyContainsValueCopyToEqualsGetByIndexGetEnumeratorGetHashCodeGetKeyGetKeyListGetTypeGetValueListSortedList ClassProperties:Capacity Count IsFixedSizeIsReadOnlyIsSynchronizedItemKeysSyncRootValuesVí dụ SortedListVí dụ SortedListVí dụ SortedList lưu Đối tượngString Khai báo string: string message1 = "Hello"; message1 += ", There"; string message2 = message1 + "!"; Các method của StringString Regular Expression (System.Text.RegularExpressions)String FormatStringBuilder(tự xem thêm)

Các file đính kèm theo tài liệu này:

  • ppt_p5_collection_string_6618.ppt
Tài liệu liên quan