Upload
manton
View
63
Download
3
Embed Size (px)
DESCRIPTION
Introduction to the Visual Studio 2010. Chapter 1:. What C# is &How a C# Program runs . What’s the .NET Framework & What it contains. What you Learn in this chapter?. Visual Studio 2010 & C#. DEMO C# Console. Microsoft’s Modern software development platform. .Net Framework - PowerPoint PPT Presentation
Citation preview
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Introduction to the Visual Studio 2010
Chapter 1:
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
What you Learn in this
chapter?
What’s the .NET Framework &
What it contains
What C# is &How a
C# Program runs
Visual Studio 2010& C#
DEMO C# Console
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
.Net Framework[4.0]
Microsoft’s Modern software development platform
Support several programming languages: C# ,VB, C++,F#...
Common Language Runtime (CLR)
Include .NET Framework Class Library(FCL)
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Programming language use to create application will run in the .NET CLR
Why C# ?
Evolution of the C & C++ languages
Incorporate the best features from other languages & Clearing up their problems
Syntax is simple
Directly accessing & manipulating system memory
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Application you can write in C#
Windows Application
Web Application Web Services
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
How a C# program runs?
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
C# Source(.cs)
C# compiler
Assembly(.exe or .dll)
CLR loader
CLRJIT compiler
Operating system
CPU & otherhardware
.NET libraries
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
1 Write source code c# and saved file with .cs extension
2 C# compiler=> Compile source code to an intermediate language (MSIL)
3 MSIL is contained in an assembly(.exe or .dll extension)
4 Can use source code or reference .NET framework libraries
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
5 CLR runs on top of host operating system
6 CLR loads assembly & uses JIT compiler to translate MSIL to native machine code
7 Load .NET libraries if need
8 MSIL code can execute on any CPUs if CPU is supported by CLR
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Visual
Studio
2010
Powerful, professional Integrated Development Environment (IDE)
Integrated compiler, debugger,Other useful tool…
We can work: Console application Window application Web application .NET Libraries
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Visual
Studio
2010
Solution ???
Project & Project Properties
Build ???
Debugging???
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Solutions and Projects group the items needed to create a program or application: A Solution can contain one or more Project A Project represents a particular part of a
solution A Project contains source code file, settings &
resource for application A Project can contain Class Reference libraries Etc…
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
How to create Solution
& Project?
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
1 Solution
1. File/New/Project (or Ctrl+ Shift +N)
2. Choose “Visual Studio Solutions” in left panel
3. Enter Name & location solution => click OK
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
You can see “Solution1” name in the right panel
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
HowTo
add New
Project:
2
1. Right click on Solution12. Choose Add item3. Choose New Project
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
add New
ProjectDialog
You can choose any Application
Type name & click OK
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Manydifferent projects
in the Solution
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Problem: You don’t know which Project that you want to run
1. Right click on Project2. Choose Set as
StartUp Project
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Problem: We have many Window Computing Platform…
To any PC can run your Application, you must config as below
Right click on Project & choose Properties
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Or Go to menu Project => Choose Project properties
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Project Properties dialog
1. Go to Build tab2. Platform target
please choose “Any CPU”
3. Save project
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
How to add New Item in the Project
1.Right click on Project2.Choose Add item3.Choose New Item
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Choose anyitem
Enter name and click “Add” button
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
AssemblyInfo file Reference .NET libraries
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Solution Folder content
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Project Folder content
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
How to build Solution & Project
Build Solution
Build Project
Batch Build
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Batch Build You should use Batch Build
You can check or uncheck project to build
Build
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
How to Debugging?
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
1. Choose line you want to start debugging
2. Go to Debug menu3. Choose Toggle
Breakpoint or press F9
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Breakpoint here
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
4. Go to Debug5. Choose Start Debugging or press F5
Also you can clear all Breakpoints
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
You can see The Yellow Line
And the name + value of variables
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Step IntoStep OverStep Out
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
Use QuickWatch to see detail information of variable at runtime
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
QuickWatchDialog here
Variable’s infor
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
You can change value of the variable and click Reevaluate button
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
FACULTY OF IMFORMATION TECHNOLOGY
Author: Nguyen Ngoc Khuong– Phone : 0976649996- Email: [email protected]– Blog: http://khuongfit.wordpress.com
HAI PHONG UNIVERSITY
END