Overview
This 5-day, lecture-and-lab course presents object-oriented programming with Visual C# 2008. Key topics include the Visual C# 2008 Express IDE (or Visual Studio 2008), classes, objects, encapsulation, interfaces, inheritance, polymorphism, abstract classes, creating class libraries, Language Integrated Query (LINQ), generic collections, event-driven programming, Windows Forms graphical user interfaces (GUIs), Windows Presentation Foundation (WPF) GUI and graphics, exception handling, file processing and generics. Students create Visual C# applications, understand C# object-oriented programming, learn to use various .NET Framework Class Library classes and participate in laboratory assignments for hands on experience.
Prerequisites
- Some object-oriented programming experience in a language such as C++, Java or Visual Basic .NET.
- Students without previous object-oriented programming experience may enroll in the course. Deitel will provide reading and lab assignments to be completed prior to the start of the course.
Course Outline
Introduction
Review of C# syntax and concepts:
- Introduction to the Visual C# 2008 Express IDE
- Introduction to C# Applications
- Introduction to Classes and Objects
- Control Statements
- Methods
- Arrays
Introduction to LINQ and Generic Collections
- Querying an Array Using LINQ
- Introduction to Collections
- Querying a Generic Collection Using LINQ
- Deitel LINQ Resource Center
Classes and Objects: A Deeper Look
- Time Class Case Study
- Controlling Access to Members
- Referring to the Current Object’s Members with the this Reference
- Indexers
- Time Class Case Study: Overloaded Constructors
- Default and Parameterless Constructors
- Composition
- Garbage Collection and Destructors
- static Class Members
- readonly Instance Variables
- Time Class Case Study: Creating Class Libraries
- Class View and Object Browser
Object-Oriented Programming: Inheritance
- Base Classes and Derived Classes
- protected Members
- Relationship between Base Classes and Derived Classes
- Creating and Using a CommissionEmployee Class
- Creating a BasePlusCommissionEmployee Class without Using Inheritance
- Creating a CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy
- CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using protected Instance Variables
- CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using private Instance Variables
- Class object
Polymorphism, Interfaces & Operator Overloading
- Polymorphism Examples
- Demonstrating Polymorphic Behavior
- Abstract Classes and Methods
- Case Study: Payroll System Using Polymorphism
- Operator is and Downcasting
- Summary of the Allowed Assignments Between Base Class and Derived Class Variables
- sealed Methods and Classes
- Case Study: Creating and Using Interfaces
- Common Interfaces of the .NET Framework Class Library
- Operator Overloading
Exception Handling
- Exception Handling Overview
- Example: Divide by Zero Without Exception Handling
- Handling DivideByZeroExceptions and FormatExceptions
- Enclosing Code in a try Block
- Catching Exceptions
- Uncaught Exceptions
- Termination Model of Exception Handling
- Flow of Control When Exceptions Occur
- .NET Exception Hierarchy
- Determining Which Exceptions a Method Throws
- finally Block
- Exception Properties
- User-Defined Exception Classes
Graphical User Interfaces with Windows Forms
- Windows Forms
- Event Handling
- A Simple Event-Driven GUI
- Another Look at the Visual Studio Generated Code
- Delegates and the Event-Handling Mechanism
- Other Ways to Create Event Handlers
- Locating Event Information
- Control Properties and Layout
- Labels, TextBoxes and Buttons
- GroupBoxes and Panels
- CheckBoxes and RadioButtons
- PictureBoxes
- ToolTips
- NumericUpDown Control
- Mouse-Event Handling
GUI with Windows Presentation Foundation
- Windows Presentation Foundation (WPF)
- XML Basics
- Structuring Data
- XML Namespaces
- Declarative GUI Programming Using XAML
- Creating a WPF Application in Visual Basic Express
- Laying Out Controls
- General Layout Principles
- Layout in Action
- Event Handling
- Commands and Common Application Tasks
- WPF GUI Customization
- Using Styles to Change the Appearance of Controls
- Customizing Windows
- Defining a Control’s Appearance with Control Templates
- Data-Driven GUIs with Data Binding
WPF Graphics and Multimedia
- Controlling Fonts
- Basic Shapes
- Polygons and Polylines
- Brushes
- Transforms
- WPF Customization: A Television GUI
- Animations
Files and Streams
- Classes File and Directory
- Creating a Sequential-Access Text File
- Reading Data from a Sequential-Access Text File
- Serialization
- Creating a Sequential-Access File Using Object Serialization
- Reading and Deserializing Data from a Sequential-Access File
Generics
- Motivation for Generic Methods
- Generic Method Implementation
- Type Constraints
- Overloading Generic Methods
- Generic Classes
- Notes on Generics and Inheritance
Collections
- Introduction
- Collections Overview
- Class Array and Enumerators
- Generic Class SortedDictionary
- Generic Class LinkedList