You can customize Visual Studio .NET to create the Run() method for you each time you create a console application. Before doing this, make sure you have a current backup of your entire installation. Then follow these steps to create a template for console applications for use with this book:
Navigate to the Templates directory. Typically this path is Program Files\ Microsoft Visual Studio .NET\ VC#\ VC#Wizards\ CSharpConsoleWiz\ Templates\ 1033.
Make a copy of file1.cs.
Open file1.cs to edit using Notepad or similar text editor.
Remove whatever comments you no longer want in your console applications.
Change the class name from [! output SAFE_CLASS NAME] to Tester.
Remove the parameters to Main() and the attribute above it.
Add the Run() method.
Instantiate Tester and invoke Run from within Main().
Save the file and start up Visual Studio .NET. Create a new console application to test that your code worked.
If at any time you decide you'd like to revert to the original template, simply restore the backup copy of file1.cs that you made earlier.
8.7.3 Using Static Fields
A common use of static member variables, or fields, is to keep track of the number of instances/objects that currently exist for your class. In the next example, you create a Cat class. The Cat class might be used in a pet-store simulation.DAY 1 MICROSOFT DOT NET FRAME WORK
DAY 2 MICROSOFT DOT NET BASE CLASS LIBRARY
DAY 3 MICROSOFT DOT NET CLASSES AND STRECTURES
DAY 4 METHODS IN FRAME WORK
DAY 5 INPUT VALIDATIONS IN DOT NET PART ONE
DAY 6 INPUT VALIDATIONS IN DOT NET PART TWO
DAY 7 DATA TYPES IN DOT NET
DAY 8 DATA TYPES IN DOT NET PART TWO
DAY 9 IMPLEMENTING PROPERTIES IN DOT NET
DAY 10 DELEGATES AND EVENTS
DAY 11 OOPS INTRODUCTION
DAY 12 POLYMORPHISM
DAY 13 INHERITANCE AND POLYMORPHISM
DAY 14 EBUGGING TOOLS IN DOT NET
DAY 15 DEBUG AND TRACE IN CLASSES
DAY 16 UNIT TEST PLAN
DAY 17 EXCEPTIONS IN VISUAL STUDIO
DAY 19 ADO.NET INTRODUCTION
DAY 20 DATA ACCESSING IN DOT NET
DAY 21 DATA BASE OBJECTS