Exposing Custom Types

Properties can expose both reference and value types, and they are not limited to built-in .NET types, meaning that 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:

image

You can use the same technique for exposing custom structures. After all, you do nothing different than when you expose strings and integers. Remember that if you do not initialize properties with values, value types returned by properties will have a default value while reference ...

Get Visual Basic® 2010 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.