week 1: the c# language
DESCRIPTION
Week 1: THE C# LANGUAGE. Chapter 1: Variables and Expressions ➤ I ncluded in Visual Studio.NET ➤What the .NET Framework is and what it contains ➤ How .NET applications work ➤ What C# is and how it relates to the .NET Framework - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/1.jpg)
C#4.0Week 1: THE C# LANGUAGE
Chapter 1: Variables and Expressions ➤Included in Visual Studio.NET ➤What the .NET Framework is and what it contains ➤ How .NET applications work ➤ What C# is and how it relates to the .NET Framework ➤ What tools are available for creating .NET applications with C#
![Page 2: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/2.jpg)
C#4.0
Included in Visual Studio.NET Visual Basic (VB.Net, VB 7.0) C++ C# (đọc là C Sharp) J# (J Sharp) .NET Framework
Windows Programming 1 Chapter 1: Introducing C# Slide 2
![Page 3: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/3.jpg)
C#4.0
Install Visual Studio.NET 2010
Windows Programming 1 Chapter 1: Introducing C# Slide 3
Chạy file setup.exe ta được hình minh họa (chú ý cài khá lâu có thể hơn 45phút)
![Page 4: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/4.jpg)
C#4.0
Install Visual Studio.NET 2010
Windows Programming 1 Chapter 1: Introducing C# Slide 4
Trên windows XP phải Service pack3
![Page 5: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/5.jpg)
C#4.0
Install Visual Studio.NET 2010
Windows Programming 1 Chapter 1: Introducing C# Slide 5
Trên windows XP phải Service pack3
Chú ý
Nên chọn full
![Page 6: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/6.jpg)
C#4.0
WHAT IS THE .NET FRAMEWORK? Understanding the .NET Framework
Architecture
Windows Programming 1 Chapter 1: Introducing C# Slide 6
![Page 7: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/7.jpg)
C#4.0
WHAT IS THE .NET FRAMEWORK? Common Language Runtime Architecture
Windows Programming 1 Chapter 1: Introducing C# Slide 7
![Page 8: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/8.jpg)
C#4.0
WHAT IS THE .NET FRAMEWORK? Microsoft’s modern software development
platform Supports several programming languages,
including C#, Visual Basic, C++, J# Programs executed by Common Language
Runtime (CLR) Includes a large library of components
(classes) which can be used in programs
Windows Programming 1 Chapter 1: Introducing C# Slide 8
![Page 9: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/9.jpg)
C#4.0
Writing Applications Using the .NET Framework CIL (Common Intermediate Language code.),
JIT (just-in-time compiler) MSIL or IL (Microsoft Intermediate Language)
Assemblies Managed Code Garbage Collection
Windows Programming 1 Chapter 1: Introducing C# Slide 9
![Page 10: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/10.jpg)
C#4.0
Writing Applications Using the .NET Framework
Windows Programming 1 Chapter 1: Introducing C# Slide 10
C#Code
C#Compiler
Visual BasicCode
Visual BasicCompiler
COBOLCode
COBOLCompiler
ILJIT
Compiler
NativeCode
![Page 11: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/11.jpg)
C#4.0
Writing Applications Using the .NET Framework
Windows Programming 1 Chapter 1: Introducing C# Slide 11
![Page 12: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/12.jpg)
C#4.0
WHAT IS C#? Applications You Can Write with C#
Windows applications Web applications: Web services:
Windows Programming 1 Chapter 1: Introducing C# Slide 12
![Page 13: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/13.jpg)
C#4.0
Visual Studio Powerful, professional Integrated
Development Environment (IDE) Integrates compilers, debugger and many
other useful tools for development Can work with many different types of project,
including: Console (text-based) applications Windows (GUI) applications Web applications (ASP.NET) Class libraries
Windows Programming 1 Chapter 1: Introducing C# Slide 13
![Page 14: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/14.jpg)
C#4.0
Visual Studio
Solution explorer
Toolbox windows
Visual designer
Properties windows
Windows Programming 1 Chapter 1: Introducing C# Slide 14
![Page 15: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/15.jpg)
C#4.0
Visual Studio projects A project contains source code files, settings
and resources for an application May contain references to class libraries May contain data used by application Building a project:
Compiles source files Copies non-source files to output folder Creates an assembly in output folder
Building a solution builds all its projects
Windows Programming 1 Chapter 1: Introducing C# Slide 15
![Page 16: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/16.jpg)
C#4.0
Project details
References – class librariesused by this application
Solution folder contents
Project folder contents
Solution file (.sln) and project file (.csproj) are created by VS and contain solution/project configuration information
Windows Programming 1 Chapter 1: Introducing C# Slide 16
![Page 17: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/17.jpg)
C#4.0
Creating a Visual Studio project Demo
Windows Programming 1 Chapter 1: Introducing C# Slide 17
![Page 18: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/18.jpg)
C#4.0
SUMMARY
???Windows Programming 1 Chapter 1: Introducing C# Slide 18
![Page 19: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/19.jpg)
C#4.0Week 1: THE C# LANGUAGE
Chapter 2: Writing a C# Program
A basic working knowledge of Visual Studio 2010 and Visual C# 2010 Express Edition
How to write a simple console application How to write a Windows Forms application
![Page 20: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/20.jpg)
C#4.0
Visual C# 2010 Ultimate
Windows Programming 1 Chapter 2: Writing a C# Program Slide 20
![Page 21: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/21.jpg)
C#4.0
CONSOLE APPLICATIONS
Windows Programming 1 Chapter 2: Writing a C# Program Slide 21
![Page 22: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/22.jpg)
C#4.0
WINDOWS FORMS APPLICATIONS
Windows Programming 1 Chapter 2: Writing a C# Program Slide 22
![Page 23: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/23.jpg)
C#4.0
The Solution Explorer
Windows Programming 1 Chapter 1: Introducing C# Slide 23
![Page 24: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/24.jpg)
C#4.0
The Properties Window
Windows Programming 1 Chapter 1: Introducing C# Slide 24
![Page 25: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/25.jpg)
C#4.0
Code view
Windows Programming 1 Chapter 1: Introducing C# Slide 25
![Page 26: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/26.jpg)
C#4.0
The Error List Window
Windows Programming 1 Chapter 1: Introducing C# Slide 26
![Page 27: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/27.jpg)
C#4.0
SUMMARY
Windows Programming 1 Chapter 2: Writing a C# Program Slide 27
? ? ?
![Page 28: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/28.jpg)
C#4.0Week 1: THE C# LANGUAGE
Chapter 3:Variables and Expressions Basic C# syntax Variables and how to use them Expressions and how to use them
![Page 29: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/29.jpg)
C#4.0
BASIC C# SYNTAX The look and feel of C# code is similar to that
of C++ and Java. C# compilers ignore additional spacing in
code, whether it results from spaces, carriage returns, or tab characters (collectively known as whitespace characters).
Statements C# is a block-structured language, meaning
statements are part of a block of code.
Windows Programming 1 Chapter3: Variables and Expressions Slide 29
![Page 30: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/30.jpg)
C#4.0
block These blocks, which are delimited with curly
brackets ({ and }), may contain any number of statements, or none at all
Windows Programming 1 Chapter3: Variables and Expressions Slide 30
![Page 31: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/31.jpg)
C#4.0
comments Comments can be created using //… Multi-lines comments use /* … */ You can use single-line comments that start
with three / symbols instead of two /// A special comment
Comments are ignored by the compiler Used only for human readers
Windows Programming 1 Chapter3: Variables and Expressions Slide 31
![Page 32: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/32.jpg)
C#4.0
The code outlining
You can do this with the #region and #endregion keywords, which define the start and end of a region of code that can be expanded and collapsed.
Windows Programming 1 Chapter3: Variables and Expressions Slide 32
![Page 33: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/33.jpg)
C#4.0
VARIABLES C# syntax for declaring variables merely
specifies the type and variable name:<type> <name>;int intNumberOfStudents;
Declaration includes Name, follow Naming Convention Rules Data Type Required Value for Constants Optional Initial Value for Variables
Windows Programming 1 Chapter3: Variables and Expressions Slide 33
![Page 34: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/34.jpg)
C#4.0
Simple Types
Windows Programming 1 Chapter3: Variables and Expressions Slide 34
![Page 35: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/35.jpg)
C#4.0
Simple Types
Windows Programming 1 Chapter3: Variables and Expressions Slide 35
![Page 36: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/36.jpg)
C#4.0
Simple Types
Windows Programming 1 Chapter3: Variables and Expressions Slide 36
![Page 37: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/37.jpg)
C#4.0
Using Simple Type Variables
Windows Programming 1 Chapter3: Variables and Expressions Slide 37
![Page 38: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/38.jpg)
C#4.0
Variable Naming The first character of a variable name must be
either a letter, an underscore character ( _ ), or the at symbol (@).
Subsequent characters may be letters, underscore characters, or numbers.
Windows Programming 1 Chapter3: Variables and Expressions Slide 38
![Page 39: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/39.jpg)
C#4.0
String Literals
Windows Programming 1 Chapter3: Variables and Expressions Slide 39
![Page 40: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/40.jpg)
C#4.0
String Literals This means that the following strings are
equivalent:"Karli \’s string.""Karli \u0027 s string.“
@ "A short list:item 1item 2“
"C:\\Temp\\MyDir\\MyFile.doc“ @ "C:\Temp\MyDir\MyFile.doc"
Windows Programming 1 Chapter3: Variables and Expressions Slide 40
![Page 41: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/41.jpg)
C#4.0
EXPRESSIONS Operators can be roughly classified into three
categories: ➤ Unary— Act on single operands ➤ Binary—Act on two operands ➤ Ternary—Act on three operands
Windows Programming 1 Chapter3: Variables and Expressions Slide 41
![Page 42: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/42.jpg)
C#4.0
Mathematical Operators
Windows Programming 1 Chapter3: Variables and Expressions Slide 42
![Page 43: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/43.jpg)
C#4.0 Windows Programming 1 Chapter3: Variables and Expressions Slide 43
![Page 44: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/44.jpg)
C#4.0
Manipulating Variables with Mathematical Operators
Windows Programming 1 Chapter3: Variables and Expressions Slide 44
![Page 45: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/45.jpg)
C#4.0
Assignment Operators
Windows Programming 1 Chapter3: Variables and Expressions Slide 45
![Page 46: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/46.jpg)
C#4.0
Operator Precedence
Windows Programming 1 Chapter3: Variables and Expressions Slide 46
![Page 47: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/47.jpg)
C#4.0
Namespaces Namespaces are also used as a means of
categorizing items in the .NET Framework C# code, by default, is contained in the global
namespace Qualified names use period characters (.)
between namespace levels System.Int32
Windows Programming 1 Chapter3: Variables and Expressions Slide 47
![Page 48: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/48.jpg)
C#4.0
Namespaces
Windows Programming 1 Chapter3: Variables and Expressions Slide 48
Code in the global namespace, however, must refer to this name using the classified name LevelOne.NameOne.
![Page 49: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/49.jpg)
C#4.0
Namespaces Within a namespace, you can define nested
namespaces, also using the namespace keyword.
Windows Programming 1 Chapter3: Variables and Expressions Slide 49
![Page 50: Week 1: THE C# LANGUAGE](https://reader036.vdocuments.net/reader036/viewer/2022062810/56815e60550346895dccdb9f/html5/thumbnails/50.jpg)
C#4.0
SUMMARY
Windows Programming 1 Chapter 3: Variables and Expressions Slide 50
? ? ?