intro to c#
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 PresentationTRANSCRIPT
Intro to C#
Head First C#
Programming Coverage
Methods, Classes, Arrays
Iteration, Control Structures
Variables, Expressions
Data Types
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?
Book’s Design
• Brain craves novelty
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
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.
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!
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.
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
Contacts Database
Structure of our Program
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
Contacts Database
• Add picturebox to form– Insert logo graphic from
http://www.headfirstlabs.com/books/hfcsharp/– Will need to download and unzip the file
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"); }
Run your program
• Where are my files?
Click Green Triangle
Next Steps
• See book/lecture for details– Add database– Add “People” Table
Who Does What?
Complete The Table
Also, type in sample data into the table (see in class)
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
Intro to Computing
(From C# Software Solutions)
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
Main Memory – a big list of addresses
The Fetch-Decode Execute Cycle
• 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
Bits could represent characters
We said that 00010001 could representanything, a number, sound, color, etc.
Bits could represent sound
Layers of Programming Languages
OperatingSystem
ApplicationsBIOSCPU
Layers of Software Systems
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
.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