Now that we have introduced key concepts of object-oriented programming, we present two features that Visual Studio provides to facilitate the design of object-oriented applicationsClass View and Object Browser.
Using the Class View Window
The Class View displays the fields and methods for all classes in a project. To access this feature, select Class View from the View menu. Figure 9.21 shows the Class View for the Time1 project of Fig. 9.1 (class Time1) and Fig. 9.2 (class TimeTest1). The view follows a hierarchical structure, positioning the project name (Time1) as the root and including a series of nodes that represent the classes, variables and methods in the project. If a plus sign (+) appears to the left of a node, that node can be expanded to show other nodes. If a minus sign (-) appears to the left of a node, that node can be collapsed. According to the Class View, project Time1 contains class Time1 and class TimeTest1 as children. When class Time1 is selected, the class's members appear in the lower half of the window. Class Time1 contains methods SetTime, ToString and ToUniversalString (indicated by purple boxes) and instance variables hour, minute and second (indicated by blue boxes). The lock icons, placed to the left of the blue box icons for the instance variables, specify that the variables are private. Class TimeTest1 contains method Main. Note that both class Time1 and class TimeTest1 contain the Base Types node. If you expand this node, you will see class object in each case, because each class inherits from class System.Object (discussed in Chapter 10).
Figure 9.21. Class View of class Time1 (Fig. 9.1) and class TimeTest (Fig. 9.2).
Using the Object Browser
Visual C# Express's Object Browser lists all classes in the C# library. You can use the Object Browser to learn about the functionality provided by a specific class. To open the Object Browser, select Other Windows from the View menu and click Object Browser. Figure 9.22 depicts the Object Browser when the user navigates to the Math class in namespace System in the assembly mscorlib (Microsoft Core Library). [Note: Be careful not to confuse the System namespace with the assembly named System. The System assembly describes other members of the System namespace, but class System.Math is in mscorlib.] The Object Browser lists all methods provided by class Math in the upper-right framethis offers you "instant access" to information regarding the functionality of various objects. If you click the name of a member in the upper-right frame, a description of that member appears in the lower-right frame. Note also that the Object Browser lists in the left frame all classes of the FCL. The Object Browser can be a quick mechanism to learn about a class or a method of a class. Remember that you can also view the complete description of a class or a method in the online documentation available through the Help menu in Visual C# Express.
Figure 9.22. Object Browser for class Math.
(Optional) Software Engineering Case Study Starting to Program the Classes of the ATM System |
Preface
Index
Introduction to Computers, the Internet and Visual C#
Introduction to the Visual C# 2005 Express Edition IDE
Introduction to C# Applications
Introduction to Classes and Objects
Control Statements: Part 1
Control Statements: Part 2
Methods: A Deeper Look
Arrays
Classes and Objects: A Deeper Look
Object-Oriented Programming: Inheritance
Polymorphism, Interfaces & Operator Overloading
Exception Handling
Graphical User Interface Concepts: Part 1
Graphical User Interface Concepts: Part 2
Multithreading
Strings, Characters and Regular Expressions
Graphics and Multimedia
Files and Streams
Extensible Markup Language (XML)
Database, SQL and ADO.NET
ASP.NET 2.0, Web Forms and Web Controls
Web Services
Networking: Streams-Based Sockets and Datagrams
Searching and Sorting
Data Structures
Generics
Collections
Appendix A. Operator Precedence Chart
Appendix B. Number Systems
Appendix C. Using the Visual Studio 2005 Debugger
Appendix D. ASCII Character Set
Appendix E. Unicode®
Appendix F. Introduction to XHTML: Part 1
Appendix G. Introduction to XHTML: Part 2
Appendix H. HTML/XHTML Special Characters
Appendix I. HTML/XHTML Colors
Appendix J. ATM Case Study Code
Appendix K. UML 2: Additional Diagram Types
Appendix L. Simple Types
Index