May 2010
Intermediate to advanced
1272 pages
61h 18m
English
Visual Basic language enables defining default properties. A default property is a property marked with the Default keyword that enables assignments to the objects defining the property without the need of invoking the property itself. Default properties are strictly related to data arrays and collections of objects, because they provide the ability of managing an index. For example, imagine you have an array of strings defined within a class as follows:
Private listOfNames() As String = _ {"Alessandro", "Del Sole", "VB 2010 Unleashed"}
A default property enables easy access to such an array, both for reading and writing. The following code demonstrates how you can implement a default property:
Read now
Unlock full access