Summary
Today you learned how to build your own ASP.NET pages using VB.NET and C#. After today's lesson, you should have a strong grasp of the programming fundamentals that will allow you to build more complex pages.
You began today's lesson by looking at variables in both VB.NET and C#. Variables are named locations in memory that you can manipulate by referencing their names. There are 10 basic data types for variables, divided into five categories: integers, floating-point numbers, Booleans, strings, and datetimes.
Arrays are collections of variables that can be referenced by indices. These are useful for storing similar information in one place. All arrays are indexed starting at 0. You cannot create an array that has an index starting at any value other than 0.
You learned about three types of logic today: conditional, looping, and branching. Conditional logic uses if statements and case (or switch) statements to evaluate conditions. Looping logic uses while, do, and for loops to execute a code block multiple times. Branching logic uses subroutines and functions that each perform some action, but functions can return values.
You also looked at events, which are things that may happen to your application, and event handlers, which are the methods that perform an action when an event occurs. These are very similar to subroutines but are distinguished by their parameter lists.
Finally, you were introduced to classes and inheritance. You examined classes, which are definitions of objects. They group common code together to represent an entity with properties and methods. Classes are an important part of the .NET Framework and ASP.NET. Inheritance allows you to extend existing classes to meet your needs and override methods that don't.
Today you learned about many of the most difficult tasks in ASP.NET programming. Once you can easily create methods, event handlers, and classes, you'll be ready to take on any ASP.NET page! While C# and VB.NET are two completely different languages, you'll learn that they both use the same set of common classes and objects; the functionality of each language is virtually identical, and only the syntax varies slightly. You should be able to switch from one language to another fairly easily (or at least understand both from a high level). We'll use both languages throughout this book, so you can choose to follow the one you prefer. You are encouraged, though, to try to learn and follow bothyou'll be much better off in the long run.
Tomorrow you'll examine some of the most common objects used with ASP.NET, that can be used with both VB.NET and C#.