
Chapter 3: Learning Just Enough C# and VB.NET: Types and Members | 69 |
{
public class Employee
{
public string FirstName;
}
}
VB:
Public Class Employee
Public Dim FirstName As String
End Class
The C# Employee class is nearly the same as the Program class that you created in the preceding chapter, except that the class name here is Employee. In VB, you’ve only created a module before, and the Employee class is your first class for this book. You can add members to a class, which could be events, fields, methods, and properties. Listing
Listing
Listing 3-2 Code that uses a class
C#:
Employee emp = new Employee(); emp.FirstName = "Joe";
VB:
Dim emp As New Employee emp.FirstName = "Joe"
In Listing