Use Properties and Methods for Proper Class Design
Use inheritance to cut down the amount of code you need to write
Learn to control the visibility and the lifetime of data
Raise and consume events from your classes
Eliminate multiple methods by using a generic method
Learn to manipulate generic collections
Create your own class libraries for a proper N-Tier application
C# OOP Fundamentals Class Preview
C# OOP Fundamentals Class Preview
Introduction to Object-Oriented Programming
What is a Class?
What is an Object?
Properties, Methods and Access Modifiers
Namespaces and Events
Static vs Instance
Constructors, Destructors and Unmanaged Resources
Test your knowledge of OOP Terminology
Use Properties to Hold Data in Your Classes
Property Naming and Syntax
Create a Console Application
Create Auto-Properties in a Product Class
Alternate Method of Instantiating and Initializing Objects
Create a Full Property
Create a Read-Only Property
Use an Expression Body Definition
Self-Paced Lab: Create application and Product class and add properties to class
Test your knowledge of Properties
Resource: Finished Lab Samples
Resource: Sample Code Demonstrated in Section
Manipulate Property Data Using Methods
Using and Naming Methods
Create a Void Method
Create a Method to Return a Value
Create Constructors to Initialize Data
Use Constants for Hard-Coded Data
Parameters, Arguments and Overloading
Optional Parameters
Named Parameters
Passing Arguments to a Constructor
Call Parameters by Value
Call Parameters by Reference
Using Output Parameters
Self-Paced Lab: Add methods to class, create constructors and pass parameters.
Test your knowledge of Using Methods and Parameters
Resource: Finished Lab Samples
Resource: Sample Code Demonstrated in Section
Inheritance Makes it Easy to Reuse Code
Inheritance Terminology
Create a Person Class
Inherit from the Person Class
Override the ToString() Method
Override Your Own Method
Create a Customer Class that Inherits from Person
Self-Paced Lab: Create a class, inherit from it and override methods.
Test your knowledge of Inheritance
Resource: Finished Lab Samples
Resource: Sample Code Demonstrated in Section
Additional Inheritance Concepts
Interface Inheritance
Demonstration of Interface Inheritance
Working with Abstract Classes
Stopping Inheritance Using a Sealed Class
What Type of Inheritance to Use?
Self-Paced Lab: Create an interface and a abstract class.
Test your knowledge of Interfaces, Abstract and Sealed
Resource: Finished Lab Samples
Resource: Sample Code Demonstrated in Section
Control the Visibility and Lifetime of Data
Scope and Access Modifiers
Block Level Scope of Variables
Method Level Scope
Class Level Scope of Variables
Protected Scope of Variables
Scope of Methods
Scope of Classes
The Static Modifier
Create a Static Class
Create a Partial Class
Self-Paced Lab: Control the scope of variables and methods and use static
Test your knowledge of Scoping Rules and Static Classes
Resource: Finished Lab Samples
Resource: Sample Code Demonstrated in Section
Raising and Consuming Events
Create an Event in a Class
Consume an Event Raised from a Class
Create a Custom EventArgs Class
Consume and Use Data From Custom EventArgs Class
Self-Paced Lab: Create and Consume Events from a Class
Test your knowledge of Creating and Consuming Events
Resource: Finished Lab Samples
Resource: Sample Code Demonstrated in Section
Generics Eliminate Code Bloat
What is a Generic and Why Use Them
Demonstration of Not Using Generics
Create Generic Method to Replace Multiple Methods
Creating and Using a Generic Class
Self-Paced Lab: Creating and Using Generics
Test your knowledge of Generics
Resource: Finished Lab Samples
Resource: Sample Code Demonstrated in section
Generic Collections Provide Great Features
Features of Collections and the Limitations of Arrays
Creating and Adding Data to a Generic List
Remove Data From a Generic List
Find an Item in a Generic List Using a Lambda Expression
Extract a Subset of Data Using a Lambda Expression
Self-Paced Lab: Practice Working with Generic Collections
Test your knowledge of Using Generic Collections
Resource: Finished Lab Samples
Resource: Sample Code Demonstrated in section
Create Your Own Class Libraries
The Most Common Types of Class Libraries to Create
How Each Type of Class Library is Used
Advantages of Class Libraries and a Common Library
Create the Common Class Library
What to Put into MVC and WPF Class Libraries
Self-Paced Lab: Creating Class Libraries
Test your knowledge of Class Libraries
Resource: Finished Lab Samples
Resource: Sample Code Demonstrated in section