CS1. Introduction to C#
Rev. 2.2
Microsoft’s .NET is a revolutionary advance in programming
technology that greatly simplifies application development and is a good match
for the emerging paradigm of Web-based services, as opposed to proprietary
applications. Part of this technology is a new language, C#. This new language
combines the power of C++ and the ease of development of Visual Basic. It bears
a striking resemblance to Java and improves on that language. C# may well
become the dominant language for building applications on Microsoft platforms.
This thorough and comprehensive course is a practical introduction
to programming in C#, utilizing the services provided by .NET. This course
emphasizes the C# language. It is current to Visual Studio 2005 and .NET 2.0.
For students pursuing MCTS certification, this course provides the
C# foundation required for Object Innovations’ series of courses designed to
assist in exam preparation. Further important topics in C#, such as interfaces,
delegates and events, are covered in the follow-on course CS5, .NET Framework
Foundations Using C#. A standalone C# course covering these additional topics
is 410, Object-Oriented Programming in C#.
This course is intended to be fully accessible to programmers who do
not already have a strong background in object-oriented programming in C-like
languages, such as C++ or Java. It is ideal, for example, for Visual Basic or
COBOL programmers who desire to learn C#.
An important thrust of the course is to teach C# programming from an
object-oriented perspective. It is often difficult for programmers trained
originally in a procedural language to start “thinking in objects.” This course
introduces object-oriented concepts early, and C# is developed in a way that
leverages its object orientation. There is thorough coverage of traditional
object-oriented features, such as classes, inheritance, and polymorphism, as
well as newer features like properties and indexers. A case study is used to
illustrate creating a complete system using C# and .NET.
Numerous programming examples and exercises are provided, including
the case study. The student will receive a comprehensive set of materials,
including course notes and all the programming examples. The course includes
two electronic supplements, provided as PDF files. The first covers Visual
Studio 2005, and the second covers unsafe code and the C# pointer type.
LEARNING OBJECTIVES
·
Acquire a working knowledge of C# programming
·
Learn how to implement programs using C# and
classes from the .NET Framework
·
Gain a working knowledge of the object-oriented
features of C#
Course Duration: 4
days.
Prerequisites: The student should have programming
experience in a high-level language.
1.
NET: What You Need To Know
.NET Executables and the CLR
A .NET Testbed for C# Programming
Using Visual Studio 2005
2.
First C# Programs
Hello, World
Namespaces
Variables and Expressions
Using C# as a Calculator
Input/Output in C#
.NET Framework Class Library
3.
Data Types in C#
Data Types
Integer Types
Floating Point Types
Decimal Type
Characters and Strings
Boolean Type
Conversions
Nullable Types
4.
Operators and Expressions
Operator Cardinality
Arithmetic Operators
Relational Operators
Logical Operators
Bitwise Operators
Assignment Operators
Expressions
Checked and Unchecked
5.
Control Structures
If Tests
Loops
Arrays
Foreach
More about Control Flow
Switch
6.
Object-Oriented Programming
Objects
Classes
Inheritance
Polymorphism
Object-Oriented Languages
Components
7.
Classes
Classes as Structured Data
Methods
Constructors and Initialization
Static Fields and Methods
Constant and Readonly
8.
More about Types
Overview of Types in C#
Value Types
Boxing and Unboxing
Reference Types
9.
Methods, Properties and Operators
Methods
Parameter Passing
Method Overloading
Variable-Length Parameter Lists
Properties
Operator Overloading
10. Characters
and Strings
Characters
Strings
String Input
String Methods
StringBuilder Class
Programming with Strings
11. Arrays
and Indexers
Arrays
System.Array
Random Number Generation
Jagged Arrays
Rectangular Arrays
Arrays as Collections
Bank Case Study—Step 1
Indexers
12. Inheritance
Single Inheritance
Access Control
Method Hiding
Initialization
Bank Case Study—Step 2
13. Virtual
Methods and Polymorphism
Virtual Methods and Dynamic Binding
Method Overriding
Fragile Base Class Problem
Polymorphism
Abstract Classes
Sealed Classes
Heterogeneous Collections
Bank Case Study—Step 3
14. Formatting
and Conversion
ToString
Format Strings
String Formatting Methods
Bank Case Study—Step 4
Type Conversions
15. Exceptions
Exception Fundamentals
Structured Exception Handling
User-Defined Exception Classes
Inner Exceptions
Bank Case Study—Step 5
Appendix A. Learning
Resources
Electronic File Supplements
Supplement 1. Using Visual Studio 2005
Overview of Visual Studio 2005
Creating a Console Application
Project Configurations
Debugging
Multiple-Project Solutions
Supplement 2. Unsafe Code
and Pointers in C#
Unsafe Code
C# Pointer Type
System Requirements
Course exercises require Microsoft Visual Studio 2005 on Windows XP
with Service Pack 2. Visual C# 2005 Express Edition can also be used. See the
appropriate course Setup Guide for details.
A good minimal hardware profile for this course would have a Pentium
1 GHz or equivalent CPU, 512 MB of RAM, and at least 4 GB of free disk space for
tools installation and courseware.