580 likes | 1k Views
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
E N D
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 [4.0] Support several programming languages: C# ,VB, C++,F#... Common Language Runtime (CLR) Include .NET Framework Class Library(FCL)
Programming language use to create application will run in the .NET CLR Evolution of the C & C++ languages Why C# ? Syntax is simple Directly accessing & manipulating system memory Incorporate the best features from other languages & Clearing up their problems
Windows Application Application you can write in C# Web Services Web Application
CLR loader C# Source (.cs) .NET libraries CLR JIT compiler C# compiler Operating system Assembly (.exe or .dll) CPU & other hardware
Write source code c# and saved file with .cs extension C# compiler=> Compile source code to an intermediate language (MSIL) MSIL is contained in an assembly(.exe or .dll extension) Can use source code or reference .NET framework libraries 1 2 3 4
CLR loads assembly & uses JIT compiler to translate MSIL to native machine code MSIL code can execute on any CPUs if CPU is supported by CLR Load .NET libraries if need CLR runs on top of host operating system 5 6 7 8
Powerful, professional Integrated Development Environment (IDE) Integrated compiler, debugger, Other useful tool… Visual Studio 2010 • We can work: • Console application • Window application • Web application • .NET Libraries
Solution ??? Project & Project Properties Visual Studio 2010 Build ??? Debugging???
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…
How to create Solution & Project?
Solution 1 1. File/New/Project (or Ctrl+ Shift +N) 2. Choose “Visual Studio Solutions” in left panel 3. Enter Name & location solution => click OK
2 How To add New Project: Right click on Solution1 Choose Add item Choose New Project
add New Project Dialog You can choose any Application Type name & click OK
Many different projects in the Solution
Problem: You don’t know which Project that you want to run Right click on Project Choose Set as StartUp Project
Problem: We have many Window Computing Platform… Right click on Project & choose Properties To any PC can run your Application, you must config as below
Or Go to menu Project => Choose Project properties
Project Properties dialog Go to Build tab Platform target please choose “Any CPU” Save project
How to add New Item in the Project 1.Right click on Project 2.Choose Add item 3.Choose New Item
Choose any item Enter name and click “Add” button
Reference .NET libraries AssemblyInfo file
How to build Solution & Project Build Solution Build Project Batch Build
Batch Build You should use Batch Build Build You can check or uncheck project to build
Choose line you want to start debugging Go to Debug menu Choose Toggle Breakpoint or press F9
4. Go to Debug 5. Choose Start Debugging or press F5 Also you can clear all Breakpoints
You can see The Yellow Line And the name + value of variables
Step Into Step Over Step Out
Use QuickWatch to see detail information of variable at runtime
QuickWatch Dialog here Variable’s infor
You can change value of the variable and click Reevaluate button