Bài giảng Lập trình trên Windows với Microsoft® .NET - Phần 1 - Hồ Hoàn Kiếm
Giới thiệu Microsoft.Net .
Giới thiệu ngôn ngữ C# và các khái niệm cơ bản.
Lập trình hướng đối tượng với C#.
Lập trình Winforms với C#.
Lập trình cơ sở dữ liệu với ADO.Net .
Lập trình trên Windows với Microsoft® .NET Giảng viên : Hồ Hoàn Kiếm
Giới thiệu Microsoft.Net .
Giới thiệu ngôn ngữ C# và các khái niệm cơ bản.
Lập trình hướng đối tượng với C#.
Lập trình Winforms với C#.
Lập trình cơ sở dữ liệu với ADO.Net .
Nội dung môn học
Khảo sát kiến trúc .Net .
Xây dựng các ứng dụng với .Net .
Các thành phần trong .Net Framework.
Vai trò của CLR và IL .
Giới thiệu Microsoft.NET.
Microsoft .NET Framework Architecture
Windows
LINUX
Common Language Runtime
Framework Class Library
Common Language Specification
Microsoft
Visual Basic ®
.NET
C++
C#
Microsoft
JScript ®
Microsoft Visual Studio ® .NET
XML Web Services
Devices
Servers
User Experiences
Developer Tools
.NET Platform
.NET Framework
Common Language Runtime
Class Library
Windows
Web Services
ADO.NET
Data Types
Visual Basic Applications
Visual C# Applications
Visual C++ Applications
Programming Services
.NET Platform Code
Source code compiles as MSIL
JIT compiler producesmachine language
One-stop Application Development
Visual Studio .NET
Design
Develop
Debug
Deploy
Data Access
XML Web
Services Tools
Windows
Forms Tools
Web Forms Tools
Error Handling
Multiple
Languages
Các đặc điểm của Visual Studio .NET
Hổ trợ lập trình đa ngôn ngữ.
Độc lập với hệ điều hành (Platform ).
Xây dựng ứng dụng nhanh chóng và dễ dàng.
Hổ trợ xây dựng ứng dụng cho nhiều thiết bị .
Môi trường thiết kế trực quan .
Hướng đến các ứng dụng trên Internet (Webservice, WAP)
Microsoft Intermediate Language (MSIL)
Common Language Specification
VB
C++
C#
JScript
J#
Common Language Runtime (CLR)
Just In-Time Compiler (JIT)
Operating System
MSIL, JIT và CLR
Thực thi một chương trình .Net
C#
Code
C#Compiler
Visual Basic
Code
Visual BasicCompiler
COBOL
Code
COBOL
Compiler
IL
JITCompiler
NativeCode
. NET source
code
Language
Compiler
MSIL
+
Metadata
Machine
code
Code
executed
CLR
1 st Compilation
2 nd Compilation
Thực thi các chương trình .NET
Microsoft Intermediate Language
.NET source
code
Language
Compiler
MSIL
+
Metadata
Machine
code
Code
executed
CLR
MSIL
Helps Language interoperability
IL is not bytecode, but is very close to it. Therefore, when the application is executed, the IL to machine code conversion is quick!
MSIL converted to CPU-specific code by CLR
CPU-independent set of instructions
.NET source
code
Language
Compiler
MSIL
+
Metadata
Machine
code
Code
executed
CLR
CLR
Manages memory
Makes it easy to design components & applications whose objects interact across languages
Cross-language integration (especially cross-language inheritance)
Compile once, and run on any CPU & OS that supports the runtime!
Visual C#.Net và các khái niệm cơ bản
Được phát triển bởi Microsoft do nhóm Anders Hejlsberg và Scott Wiltamuth sáng tác.
Ngôn ngữ lập trình trực quan, hướng sự kiện, hướng đối tượng.
Dựa theo ý tưởng các ngôn ngữ khác : C,C++, Java và Visual Basic.
Hổ trợ đầy đủ bởi .Net Platform.
Compiler hiệu quả nhất trong .Net family.
Khả năng thay thế cho C++.
Hạn chế sử dụng con trỏ.
Chương trình C#
using System;
class SampleCSharp
{
static void Main(string [] args)
{
Console.WriteLine("Hello world");
}
}
Các kiểu dữ liệu trong C#
Các kiểu dữ liệu đơn giản : int, float, string , char, bool..
Các kiểu dữ liệu tham chiếu : đối tượng, lớp .
Các bổ từ khi sử dụng với biến : private, public, protected
Các kiểu dữ liệu khác : Array, Struct, Enum ...
Giá trị mặc định cho các kiểu dữ liệu :
Nhập và xuất trong C#
Sử dụng các phương thức của lớp Console trong namspace System.
Console.WriteLine()
Console.Write()
Console.ReadLine()
Console.Read ()
Ví dụ :
using System;
class SampleCSharp
{
static void Main(string[] args)
{
//Nhập vào 1 chuổi
string s = Console.ReadLine();
//Nhập vào số nguyên
int n = int.Parse(Console.ReadLine());
//In ra mà hình
Console.WriteLine("s = {0} va n = {1}",s,i);
}
}
Cấu trúc If
Cú pháp : if (biểu thức ){
//Các câu lệnh }
else {//Cá câu lệnh }
File đính kèm:
bai_giang_c_co_ban_chuong_1_lap_trinh_tren_windows_voi_micro.ppt

