22C:096: Topic in Computer Science:
Programming with C# in .NET

Table of Contents


1. Writing a C# Program.

Getting Ready to Program.
A First Program.
Problem Solving: Recipes.
Algorithms—Being Precise.

Implementing Our Algorithm in C#.
Writing and Running a C# Program.
Interrupting a Program.
Typing an End-of-File Signal.
Software Engineering: Style.
Dr. P's Prescriptions.
C# Compared with Java and C++.

Presentation materials(PDF), Presentation materials (PPT)


2. Native Types.
Program Elements.
Comments.
Keywords.
Identifiers.
Literals.
Operators and Punctuators.
Console Input/Output.
Program Structure.
Redirection.
Simple Types.
Declaration and Initialization.
The Implicit Conversions.
The Explicit Conversions.
Enumeration Types.
Expressions.
Precedence and Associativity of Operators.
The Dot Operator name.name.
Relational, Equality, and Logical Operators.
Software Engineering: Debugging.
Dr. P's Prescriptions.
C# Compared with Java and C++.

Presentation materials(PDF), Presentation materials (PPT)


3. Statements

Assignment and Expressions.
The Statement Block.
The if and if-else Statements.
The while Statement.
The for Statement.
The do Statement.
The reak and continue Statements.
The switch Statement.
The goto Statement.
Software Engineering: Debugging.
Dr. P's Prescriptions.
C# Compared with Java and C++.

Presentation materials(PDF), Presentation materials (PPT)

4. Methods: Functional Abstraction.
Method Invocation.
Static Method Definitions.
The return statement.
Scope of Variables.
Top-Down Design.
Problem Solving: Random Numbers.
A Simulation: Probability Calculations.
Invocation and Call-By-Value.
Call-By-Reference

The out Parameter.

Recursion.
Problem Solving: Mathematical Methods.
Method Overloading.
Programming Style.
Software Engineering: Program Correctness.
Dr. P's Prescriptions.
C# Compared with C++ and Java.

Presentation materials(PDF), Presentation materials (PPT)

5. Arrays.

One-Dimensional Arrays.
Indexing an Array Element.
Array Initialization.
Array Member Length.

An Example: Summing an Array.
Passing Arrays to Methods.
The System.Array.Copy() Method.

Finding the Minimum and Maximum of an Array.
The foreach statement.
Array Methods and Properties.
A Simple Sorting Method.
Searching an Ordered Array.
Recoding BinarySearch recursively.

Big-Oh: Choosing the Best Algorithm.
Type and Array.
Booleans: The Sieve of Eratosthenes
char:Counting characters with a buffer.
double:Overloading Accumulate().

Two-Dimensional Arrays.
Two-dimensional Initializer Lists.
Jagged Two-dimensional arrays.

An Elementary Simulation: The Game of Life.
The Game of Life: Design.
The Game of Life: Implementation.

Software Engineering.
Array loop idioms.
Counting from Zero.
Debugging and Testing Code.
Dr. P's Prescriptions.
C# Compared with Java and C++.

Presentation materials(PDF), Presentation materials (PPT)

6. Classes and Abstract Data Types.
Type class , Operator dot, and new().
Member Access Operator.

INSTANCE Methods.
Access: Private and Public.
An Example: Customer.
Class Scope.
The dot Operator, namespaces and class names.
Nested Classes.

The standard class string.
An Example: Flushing.
The this Reference.
static Members.
const Members.

A Container Class Example: CharStack.
Properties AND DATA Hiding.
Software Engineering: Class Design.
Trade-Offs in Design.
Unified Modeling Language (UML) and Design.
Dr. P's Prescriptions.
C# Compared with Java and C++.
Presentation materials(PDF), Presentation materials (PPT)

7. Constructors, Conversions, and Operator Overloading.
Classes with Constructors.
The Default Constructor.
Improving the Point Class.
Constructing a Stack.
The Copy Constructor.

Classes with Destructors.
Members That Are Class Types.
Polymorphism Using Method Overloading.
ADT Conversions.
Overloading and Signature Matching.
Overloading Operators.
Unary Operator Overloading.
Binary Operator Overloading.
Static Constructors.
Software Engineering: When to Use Overloading.
Dr. P's Prescriptions.
C# Compared with Java and C++.

Presentation materials(PDF), Presentation materials (PPT)


8. Inheritance.

A Derived Class.
More Unified Modeling Language (UML).

A Student ISA Person.
virtual methods: Dynamic Determination.
Overloading and Overriding Confusion.
A Canonical Example: Class shape.

Abstract Base Classes.
Everyone's ancestor class Object.
Methods and boxing/unboxing.

Generic methods.
An Example: Predator-Prey simulation.
Interfaces.
Interface and Multiple Inheritance.
Odds and Ends.
Sealed Classes.
is and AS.
internal access.
Labeling derived methods new.


Software Engineering: Inheritance and Design.
Dr. P's Prescriptions.
C# Compared with Java and C++.

Presentation materials(PDF), Presentation materials (PPT)

March 9 Midterm

9. Input/Output.
Console Output.
Formatted Output.
User-Defined Types: Output and Format().

ToString overriding.
Creating a user defined format.

Console Input.
StandARd Methods for characters.
Console Input for an Array.
Files.
Text Files.
Example: A word count program.
Network IO.
Software Engineering: I/O.
Dr. P's Prescriptions.
C# Compared with Java and C++.

Presentation materials(PDF), Presentation materials (PPT)


10. Exceptions and Program Correctness.
Using the Assert()method.
C# Exceptions.
Throwing Exceptions.
Rethrown Exceptions.
Exception Expressions.
Exception Object Standard Methods.

try Blocks.
Handlers.
Finally Code.


Converting Assertions to Exceptions.
Standard Exceptions.
Software Engineering: Exception Objects.
Dr. P's Prescriptions.
C# Compared with Java and C++.

Presentation materials(PDF), Presentation materials (PPT) (not avaialble yet)

Chapter 11 (not our textbook) Using GUI objects and Visual Studio IDE

Create a MessageBox
Adding Functionality to MessageBox Buttons
Create a Form
Create a From which is a program main window
Place a button on a form
Use IDE to design a form
Add functionality to a button on a form
Add second button to a form

Presentation materials(PDF), Presentation materials (PPT)

Chapter 12 (not our textbook) Using Controls in GUI

Understand Controls
Create a form with label
setting a Label's font
Add Collor to a form
Using CheckBox and RadioButton objects
Add a PictureBox object to a Form
Add ListBox, CheckBox, and ComboBox objects
Add functionality to ListBox with SelectedItem
Add functionality to ListBox with Multiple SelectedItem
Supply a Default Selection for a ListBox

Presentation materials(PDF), Presentation materials (PPT)

Chapter 13 (not our textbook) Handling Events

Understand Delegates
Create composed delegate
Handling events
Use Built-in Evenhandler
Handle Control Component Events
Add more events to an application
Use IDE to generate Event-Handling Code
Setting Controls' Tab order
Use the sender Object in event
Add Main Menu

Presentation materials(PDF), Presentation materials (PPT) <-- Lecture is up here, April. 12, 2004

C# HowTo examples (<--download)


Main page
Table of Content
Homework/Projects, Quiz and Exams
Syllabus
Policy