Exposing Custom Types
Properties can expose both reference and value types, and they are not limited to built-in .NET types. Thus, you can expose your custom classes and structures through properties. The following code shows an Order
class that exposes a property of type Customer
; such type is another custom class representing a fictitious customer of your company:
Public Class Customer Public Property CompanyName As String Public Property ContactName As StringEnd ClassPublic Class Order Public Property CustomerInstance As Customer Public Property OrderID As IntegerEnd Class
You can use the same technique for exposing custom structures. After all, you do nothing different from when you expose strings ...
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.