intro to c#

37
Intro to C#

Upload: henry

Post on 23-Feb-2016

24 views

Category:

Documents


0 download

DESCRIPTION

Intro to C#. Head First C#. Programming Coverage. Who is this book for?. Do you want to Learn C#? Do you like to tinker – do you learn by doing rather than by reading? Do you prefer stimulating dinner conversation to dry, dull academic lectures? - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Intro to C#

Intro to C#

Page 2: Intro to C#

Head First C#

Page 3: Intro to C#

Programming Coverage

Methods, Classes, Arrays

Iteration, Control Structures

Variables, Expressions

Data Types

Page 4: Intro to C#

Who is this book for?

• Do you want to Learn C#?• Do you like to tinker – do you learn by doing rather than

by reading?• Do you prefer stimulating dinner conversation to dry,

dull academic lectures?• Does the idea of writing code make you bored and a

little twitchy?• Are you a kick-butt C++ or Java programmer looking for

a reference book?• Are you afraid to try something different?

Page 5: Intro to C#

Book’s Design

• Brain craves novelty

Page 6: Intro to C#

Head First Principles• Make it visual• Conversational, casual style instead of formal, lecture style• Challenge the learner to think• Get the learner’s attention

– Uses unexpected images and techniques• Touch the learner’s emotions• Redundancy

– Same topic presented multiple times in different ways for multiple learning styles

• Different activities to learn and remember when doing, not just when reading

Page 7: Intro to C#

Bend Your Brain Into Submission

1. Slow down. The more you understand the less you have to memorize.

2. Do the exercises. Write your own notes.3. Read the “There are no Dumb Questions”

sections.4. Make this the last thing you read before bed,

or the last challenging thing.5. Drink lots of water.

Page 8: Intro to C#

Bend Your Brain Into Submission

6. Talk about it. Out loud.7. Listen to your brain. Pay attention when it

feels overloaded or you find yourself skimming.

8. Feel something. Your brain needs to feel that it matters.

9. Write a lot of software!

Page 9: Intro to C#

Activities and Exercises

• The activities and exercises are part of the core content of the book.

• They are not optional!

• Ok to peek at the solutions in the book, but you should try to solve them first.

• We will do some similar activities and exercises in class.

Page 10: Intro to C#

C# Demonstration Walkthrough

• Try this on your computer• Will introduce C#.NET and the Visual Studio

IDE – Integrated Development Environment – which is a program used to write programs

Page 11: Intro to C#

Contacts Database

Page 12: Intro to C#

Structure of our Program

Page 13: Intro to C#
Page 14: Intro to C#

Contacts Database

• Start up Visual Studio, follow along book/lecture

• Points to make:– IDE creates files for you from a template– Major windows of the IDE– Reset layout

Page 15: Intro to C#

Contacts Database

• Add picturebox to form– Insert logo graphic from

http://www.headfirstlabs.com/books/hfcsharp/– Will need to download and unzip the file

Page 16: Intro to C#

Picturebox Click Event

• Double-click on the picturebox to add an event. This is called a method. Type the code inside the curly braces:

private void pictureBox1_Click(object sender, EventArgs e) { MessageBox.Show("Contact list 1.0.\nWritten by: Kenrick Mock", "About"); }

Page 17: Intro to C#

Run your program

• Where are my files?

Click Green Triangle

Page 18: Intro to C#

Next Steps

• See book/lecture for details– Add database– Add “People” Table

Page 19: Intro to C#

Who Does What?

Page 20: Intro to C#

Complete The Table

Also, type in sample data into the table (see in class)

Page 21: Intro to C#

Connect Database

• Add new database• Add new data source• Drag onto form– Click “Detail” for separate fields– Configure text/font/etc.

• Test Drive

• Skip installer, database diagram

Page 22: Intro to C#
Page 23: Intro to C#

Intro to Computing

(From C# Software Solutions)

Page 24: Intro to C#
Page 25: Intro to C#

The CPU• Fetches instructions from main memory• Carries out the operations commanded by the

instructions• Each instruction produces some outcome• A program is an entire sequence of

instructions• Instructions are stored as binary numbers• Binary number - a sequence of 1’s and 0’s

Page 26: Intro to C#

Main Memory – a big list of addresses

Page 27: Intro to C#

The Fetch-Decode Execute Cycle

Page 28: Intro to C#

• Bit: smallest and most basic data item in a computer; represents a 0 or a 1

• Byte: a grouping of eight bits– E.g., 00010001– What does this represent?

• Word: a grouping of one or more bytes

Knowing About: Computer Hardware

Page 29: Intro to C#
Page 30: Intro to C#
Page 31: Intro to C#

Bits could represent characters

Page 32: Intro to C#

We said that 00010001 could representanything, a number, sound, color, etc.

Bits could represent sound

Page 33: Intro to C#
Page 34: Intro to C#

Layers of Programming Languages

Page 35: Intro to C#

OperatingSystem

ApplicationsBIOSCPU

Layers of Software Systems

Page 36: Intro to C#

The .NET Platform• C# .NET is in a sense one step removed from a typical high-

level language• C# runs using a “Virtual Machine” or “Common Language

Runtime”– The physical computer simulates a virtual computer that

runs your program

.NET Software

.NET Software

.NET Program

Page 37: Intro to C#

.NET Framework

Framework Class Library

ADO.NET

Network

XML

Security

Threading

Diagnostics

IO

Etc.

Common Language RuntimeMemory Management Common Type System Lifecycle Monitoring

C# VB.NET C++.NET Other

Operating System

VisualStudio.NET

Common Language Specification

Windows FormsASP.NETWeb Services

ASP.NET Application Services

Web Forms Controls Drawing

Windows Application Services