Using Default Properties
Visual Basic 6 supported a wide variety of properties as default properties. This worked because we were required to use Let, Get, and Set when performing read and write operations against an object in VB6. However, Let, Get, and Set are not required or supported for VB .NET, so the compiler no longer has that codified cue. As a result a new cue was needed to differentiate a default property from an object assignment. The decision was made to support default properties only for properties that defined an indexer. The indexer is not require to be an integer, but the property must have an argument for us to use the Default keyword.
An example of a class with a default property is a class that has an Item property. Item ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access