CHAPTER 2 60 BUILDING C# APPLICATIONS To (Web hosting solutions)

CHAPTER 2 60 BUILDING C# APPLICATIONS To complete this example, update the generated SportsCar class with a public method named PrintPetName() as follows: public class SportsCar : Car { public void PrintPetName() { petName = “Fred”; Console.WriteLine(”Name of this car is: {0}”, petName); } } Object Test Bench Another nice visual tool provided by Visual Studio 2005 is Object Test Bench (OTB). This aspect of the IDE allows you to quickly create an instance of a class and invoke its members without the need to compile and run the entire application. This can be extremely helpful when you wish to test a specific method, but would rather not step through dozens of lines of code to do so. To work with OTB, right-click the type you wish to create using the Class Designer. For example, right-click the SportsCar type, and from the resulting context menu select Create Instance .Sports- Car(). This will display a dialog box that allows you to name your temporary object variable (and supply any constructor arguments if required). Once the process is complete, you will find your object hosted within the IDE. Right-click the object icon and invoke the PrintPetName() method (see Figure 2-28). Figure 2-28. The Visual Studio 2005 Object Test Bench You will see the message Name of this car is: Fred appear within the Visual Studio 2005 Quick Console. The Integrated Help System The final aspect of Visual Studio 2005 you must be comfortable with from the outset is the fully integrated help system. The .NET Framework 2.0 SDK documentation is extremely good, very readable, and full of useful information. Given the huge number of predefined .NET types (which number well into the thousands), you must be willing to roll up your sleeves and dig into the provided documentation. If you resist, you are doomed to a long, frustrating, and painful existence as a .NET developer. Visual Studio 2005 provides the Dynamic Help window, which changes its contents (dynamically!) based on what item (window, menu, source code keyword, etc.) is currently selected. For
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Leave a Reply