02 C#ProgrammingBasics
02 C#ProgrammingBasics
02 C#ProgrammingBasics
NET
Lectures & Exercises
For Example:
Button Control Events…
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
Designates the data type of the value to be returned from the subroutine.
void says the block of code does not return a value
Other data types could be returned
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
2.4 Arrays
Arrays allow a group of elements of a specific type to be stored in a contiguous
block of memory
Each item in the array had an offset called an index
Derived from System.Array
C# arrays are zero-based
Can be multidimensional
Arrays know their length(s) and rank
Bounds checking is automatic
Declare
Allocate
Initialize
2.5 Operators in C#
C# provides a fixed set of operators, whose meaning is defined for the predefined
types
Some operators can be overloaded (e.g. +)
The following table summarizes the C# operators by category
Categories are in order of decreasing precedence
Operators in each category have the same precedence
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
2.10 Namespaces
Namespaces provide a way to uniquely identify a type
Provides logical organization of types
Namespaces can span assemblies
Can nest namespaces
There is no relationship between namespaces and file structure (unlike Java)
The fully qualified name of a type includes all namespaces
The using statement lets you use types without typing the fully qualified name
Can always use a fully qualified name
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
2.11.2 Scope
Encapsulation hides certain properties and methods inside the class
Some class members need to be accessed from outside the
class. These are made public
Those that are hidden from the outside are private
Those that can only be accessed through inheritance are
protected
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
2.12 Inheritance in C#
2.13 Code-Behind
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14
Web Application Development Using ASP.NET
Lectures & Exercises
Design and create a Web site for J.CO’s Cottages Reservation System. Your
home Web page must include an image or a background picture along with a nicely
formatted logo of the company name. Include a link to a second page that lists each of
the room names as a link. The link for each room should describe the price and amenities
for the room and/or show an image for the room (images of your choice).
Note: This is a Web page; make it attractive, Use Web Controls, CSS, and AJAX for
reservation, then after selecting reserve now, it automatically redirect to the registration
By: Jefferson A. Costales, MIT, IBM -CDA, MCTS, ZCE, OCE Chapter 2 of 14