Professional Documents
Culture Documents
C#4.0
What is the .NET Framework ?
CLR, MSIL,IL,FLC
Garbage collection
Namespace
Managed Code
Garbage Collection
CT
C#.NET
C# .NET Framework
Compiler
Programmer
CT VB .NET
VB.NET Compiler
0
101101
0
MS IL 101101
0
CLR 101101
CT J# .NET
J#.NET Compiler
C++
CT
Compiler
C++.NET
C#4.0 7
Writing Applications Using the .NET
Framework
Managed Modules
b ly
Cha IL code thc thi em
Ass
Cha T
resource, metadata .N
E
C#4.0 9
Managed Code
Software
that is written using the .NET
Framework is called Managed
Managed Executable
Legacy Software
(unmanaged code)
Common Language Runtime
Windows
(OS khc)
C#4.0 10
Garbage collection
class myClass{
Managed Heap
void Method(){
variable v1;
variable v2; B
A
do{
. E
C
}
D
}
A v D s b xo do
ko cn tham chiu
hay truy cp ti
C#4.0 11
Namespaces
Namespaces are also used as a means of
categorizing items in the .NET Framework
Qualified names use period characters (.)
between namespace levels
Withina namespace, you can define
nested namespaces, also using the
namespace keyword.
System.Data Cc lp ca ADO.NET
System.Drawing Cc lp thc thi chc nng GUI
System.Threading Cc lp lp trnh MultiThread
System.Web Cc lp lin quan n HTTP protocol
System.Xml Cc lp lin quan XML
C#4.0 14
Framework (Base) Class Library FCL/BCL
c tnh li: IL, kiu d liu trong CTS
H tr Win GUI v control
WebForm (ASP.NET)
Data Access (ADO.NET)
Directory Access
File System, registry access
Networking and web browsing
.NET attributes and reflection
WinOS access
COM interoperability
C#4.0 15
Run .NET App from Client
Required MS .NET Framework compatible
MS .NET Framework 2.0, 3.5
Install .NET 3.5 Full Redistributable package
(dotnetfx35.exe, 197MB)
Windows Vista comes with .NET Framework
3.0
Windows 7 comes with .NET Framework 4.0
. .NET .NET
NET App App
App
C#4.0 16
C# Language
C#4.0 17
WHAT IS C#?
Applications You Can Write with C#
Windows applications
Web applications
Web services:
Solution explorer
Visual designer
Toolbox windows
Properties windows
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
???
C#4.0 Windows Programming 1
Slide 32
Chapter 2: Writing a C# Program
Week 1: THE C# LANGUAGE
C#4.0
Chapter 3:Variables and Expressions
Basic C# syntax
Variables and how to use them
Expressions and how to use them
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
item 1
item 2
"C:\\Temp\\MyDir\\MyFile.doc
@ "C:\Temp\MyDir\MyFile.doc"
C#4.0 Windows Programming 1
Expressions Slide 45
Chapter3: Variables and
EXPRESSIONS
Operators can be roughly classified into three
categories:
Unary Act on single operands
???
C#4.0 Windows Programming 1
Expressions Slide 52
Chapter 3: Variables and