Preparing a Sample Assembly

Before showing reflection capabilities, a good idea is to prepare an appropriate code example. First, create a new class library project and name it People. The goal of the library is to expose a special implementation of the Person class, with interfaces and enumeration implementations for a better demonstration on reflection. When ready, write the code in Listing 44.1, which is quite simple.

LISTING 44.1 Preparing Code for Reflection

Imports System.TextPublic Enum Genders    Male = 0    Female = 1End EnumPublic Interface IPerson    Property FirstName As String    Property LastName As String    Property Age As Integer    Property Gender As Genders    Event InstanceCreated()    Function ...

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.