콜렉션: 관련있는 개체들을 모아놓은(배열로) 개체"속성" -->예: Form.controls 속성에는 해당 Form에 포함된 control들이 있다. 

In general terms, a collection is an object used for grouping and managing related objects. For example, every Form has a collection of controls. (You can access this collection through the form's Controls property.) This collection is an object that represents all the controls on that form. It allows you to retrieve a control in the collection by its index, and to loop through the elements of the collection using a For Each...Next Statement (Visual Basic).

A collection can be zero-based or one-based, depending on what its starting index is. The former means that the index of the first item in the collection is 0, and the latter means that it is 1. An example of a zero-based collection is the .NET Framework Controls collection, discussed earlier on this page. The Visual Basic Collection object is an example of a one-based collection.

One-based collections can be more intuitive to Visual Basic users, because the index ranges from 1 through the value of the Count Property (Collection Object), which returns the number of items in a collection. The index of a zero-based collection, by contrast, ranges from 0 through one less than the value of the Count property. This can be appropriate when the index values are offsets from a base value or correspond to members of a zero-based enumeration.

.NET Framework collections are zero-based for the purpose of standardization. The Visual Basic Collection class is one-based for the purpose of compatibility with previous versions.

Index and Key Values

Instances of the Visual Basic Collection class allow you to access an item using either a numeric index or a String key. You can add items to Visual Basic Collection objects either with or without specifying a key. If you add an item without a key, you must use its numeric index to access it.

By contrast, collections such as System.Collections.ArrayList allow only a numeric index. You cannot associate keys with the elements of these collections, unless you construct your own mapping based, for example, on a String array holding the keys.

Adding and Removing Items

Collections also differ in whether or not you can add items to them, and if so, how those items are added. Because the Visual Basic Collection object is a general-purpose programming tool, it is more flexible than some other collections. It has an Add Method (Collection Object) for putting items into the collection and a Remove Method (Collection Object) for taking items out.

Certain specialized collections, on the other hand, do not allow you to add or remove elements using code. For example, the CheckedListBox.CheckedItems property returns a collection of references to items by index, but your code cannot add or remove items from the collection. Only the user can do this — by selecting or clearing the appropriate box in the user interface. Thus there is no Add or Remove method for this collection.


Posted by buykiwi

블로그 이미지
친절상담 무료견적 정확시공
buykiwi

카테고리

분류 전체보기 (65)
CAD (2)
프로그래밍 (19)
네트워크/보안 (4)
인터넷/웹사이트 (13)
데이타베이스 (0)
운영체제(OS) (6)
마이크로 컨트롤러 (12)
모바일 (0)
게임 (0)
그래픽스/3D (4)
멀티미디어 (0)
사무자동화/PC/IT (3)
기타 (1)

태그목록

Yesterday
Today
Total

달력

 « |  » 2024.11
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함