SlideShare a Scribd company logo
1 of 35
LECTURE 1: Introduction to Programming
CODE &TITLE: CS 2104 Visual Programming
LECTURER :MR. AKRAM ALI OMAR
EMAIL: akram.ali.omar@gmail.com
Mobile: 0778695626
1
Content
 What is Computer Programming?
 Your First C# Program
 What is C#?
 What is .NET Framework?
 What is Visual Studio?
 Compiling, Running and Debugging C# Programs
 What is MSDN Library?
2
Define: Computer Programming
Google Definition
Computer programming: creating a sequence of
instructions to enable the computer to do something
3
 Define a task / problem
 Plan your solution
 Find suitable algorithm / data structures to use
 Find suitable libraries / platforms / frameworks
 Write source code (step by step)
 Fix program errors (bugs)
 Install, configure and run the software
 Fix / improve the software over the time
Software Development Phases
4
= Specification
= Architecture / Design
= Implementation
= Testing & Debugging
= Deployment
= Maintenance
What is "C#"?
 C# is a modern programming language
 A syntax that allows to give instructions to the computer
 C# features:
 Extremely powerful
 Easy to learn
 Easy to read and understand
 Object-oriented
 Functional programming features
5
What You Need to Program?
 A programming language
 C#
 Problem to solve
 IDE, compilers, SDK
 Visual Studio, .NET Framework SDK
 Set of useful standard classes
 Microsoft .NET Framework FCL
 Help documentation
 MSDN Library
6
Your First C# Program
using System;
class HelloCSharp
{
static void Main()
{
Console.WriteLine("Hello, C#");
}
}
7
C# Code – How It Works?
using System;
class HelloCSharp
{
static void Main()
{
Console.WriteLine("Hello, C#");
}
}
8
Include the standard .NET
namespace "System"
Define a class called
"HelloCSharp"
Define the Main() method – the
program entry point
Print a text on the console by calling the
method "WriteLine" of the class "Console"
The C# Code Should Be Well Formatted
using System;
class HelloCSharp
{
static void Main()
{
Console.WriteLine("Hello, C#");
}
}
9
Class names should use PascalCase
and start with a CAPITAL letter
The { symbol should be
alone on a new line.
The } symbol should be under
the corresponding {.
The block after the { symbol
should be indented by a TAB.
Example of Bad Code Formatting
10
using
System ;
Class HelloCSharp {
static void Main( )
{ Console . WriteLine ("Hello, C#" ) ;
Console. WriteLine ( "Hello again" ) ;}
}
Such formatting makes the source code unreadable
What is .NET Framework?
11
What is .NET Framework?
 Environment for execution of .NET programs (CLR)
 Powerful library of classes (FCL)
 Common execution engine for many programming languages
 C#
 Visual Basic .NET
 Managed C++
 ... and many others
12
The building blocks of .NET Framework
13
CLR – The Heart of .NET Framework
 Common Language Runtime (CLR)
 Managed execution environment (virtual machine)
 Executes .NET applications
 Controls the execution process
 Automatic memory management (garbage collection)
 Programming languages integration
 Multiple versions support for assemblies
 Exception Handling
14
Framework Class Library
 Framework Class Library (FCL)
 Provides basic classes for developers:
 Console applications
 Web applications and web services
 XAML, WPF, Silverlight rich-media applications
 Windows Forms and WPF GUI applications
 Windows Store applications
 Database applications
 Applications for mobile devices 15
What is Visual Studio?
16
Visual Studio
• Visual Studio – Integrated Development Environment (IDE)
• Development tool that helps us to:
 Write code
 Design user interface
 Compile code
 Execute / test / debug applications
 Browse the help
 Manage project's files
17
Benefits of Visual Studio
• Single tool for:
 Writing code in many languages (C#, VB.NET, Python, …)
 Using different technologies (Web Forms, MVC, WPF, EF, WCF, …)
 For different platforms (Win8, Silverlight, Windows Phone, …)
• Full integration of most development activities (coding, compiling,
testing, debugging, deployment, version control, ...)
• Very easy to use!
18
Visual Studio – Example
19
Visual Studio
Compiling, Running and Debugging C# Programs
20
Creating New Console Application
1. File  New  Project ...
2. Choose Visual C#  Console Application
3. Choose project directory and name
21
Creating New Console Application (2)
22
4. Visual Studio creates some source code for you
Namespace
not required
Class name
should be
changed
Most imports are
not required
File name
should be
changed
Compiling the Source Code
• The process of compiling includes:
 Syntactic checks
 Type safety checks
 Translation of the source code to lower level language (MSIL)
 Creating executable files (assemblies)
• You can start compilation by
 Using Build->Build Solution/Project
 Pressing [F6] or [Shift+Ctrl+B]
23
Running Programs
• The process of running application includes:
 Compiling (if project not compiled)
 Starting the application
• You can run application by:
 Using Debug->Start menu
 By pressing [F5] or [Ctrl+F5]
• * NOTE: Not all types of projects are able to be started!
24
Debugging The Code
• The process of debugging application includes:
 Spotting an error
 Finding the lines of code that cause the error
 Fixing the error in the code
 Testing to check if the error is gone and no new errors are introduced
• Iterative and continuous process
• Debuggers help a lot
25
Debugging in Visual Studio
• Visual Studio has a built-in
debugger
• It provides:
 Breakpoints
 Ability to trace the code
execution
 Ability to inspect variables at
runtime
26
Visual Studio Blank Solution
Creating a Solution without any Projects
27
What Is a Blank Solution?
• A Visual Studio blank solution
 Solution with no projects in it
 Projects to be added later
• Why we need a blank solution in Visual Studio?
 First create a blank solution for your homework
 Then create a project for each assignment from the homework
28
Creating a Blank Solution in Visual Studio
29
What is MSDN Library?
30
What is MSDN Library?
• Complete documentation of all classes and their functionality
 With descriptions of all methods, properties, events, etc.
 With code examples
 For all Microsoft technologies
• Related articles
• Library of samples
• MSDN Library is available at msdn.microsoft.com/library
31
How to Use MSDN Library?
32
 Search in Google for certain class / method / property
 E.g.
 Or
 Or
 Use Visual Studio's built-in help system
 Press [F1] in Visual Studio in the code
 Browse http://msdn.microsoft.com Press [F1] to view
the documentation
MSDN Library
• Browsing the Documentation – Live Demo
33
Summary
• Programming: creating a sequence of instructions (source code)
• C#: modern programming language, easy to learn
• C# programs: class + main method + code in it
• .NET Framework – a modern platform for software development by
Microsoft
• Visual Studio – powerful IDE for .NET developers: write / compile /
execute / debug code
• MSDN Library – the C# and .NET documentation
34
END
35

More Related Content

Similar to LECTURE 1 - Introduction to Programming.pptx

C# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkC# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkDr.Neeraj Kumar Pandey
 
Csharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul YaoCsharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul YaoMamgmo Magnda
 
Unit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUnit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUjwala Junghare
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfAnassElHousni
 
AWS Summit Auckland - Moving MS .NET Applications One Container at a Time
AWS Summit Auckland - Moving MS .NET Applications One Container at a TimeAWS Summit Auckland - Moving MS .NET Applications One Container at a Time
AWS Summit Auckland - Moving MS .NET Applications One Container at a TimeAmazon Web Services
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notesWE-IT TUTORIALS
 
The seven pillars of aspnet
The seven pillars of aspnetThe seven pillars of aspnet
The seven pillars of aspnetNethaji Naidu
 
Learn the java basic programming with example and syntaxchapter1-part-b.pptx
Learn the java basic programming with example and syntaxchapter1-part-b.pptxLearn the java basic programming with example and syntaxchapter1-part-b.pptx
Learn the java basic programming with example and syntaxchapter1-part-b.pptxGaytriMate
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop AppFajar Baskoro
 
Csc153 chapter 01
Csc153 chapter 01Csc153 chapter 01
Csc153 chapter 01PCC
 
CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)Dilawar Khan
 
Accelerating time to delivery - Modern tools for COBOL development
Accelerating time to delivery - Modern tools for COBOL developmentAccelerating time to delivery - Modern tools for COBOL development
Accelerating time to delivery - Modern tools for COBOL developmentMicro Focus
 
A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0
A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0
A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0Antonio Chagoury
 
Moving microsoft .net applications one container at a time
 Moving microsoft .net applications one container at a time  Moving microsoft .net applications one container at a time
Moving microsoft .net applications one container at a time Amazon Web Services
 
Event Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdfEvent Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdfAliEndris3
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)Shoaib Ghachi
 

Similar to LECTURE 1 - Introduction to Programming.pptx (20)

C# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkC# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net Framework
 
Csharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul YaoCsharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul Yao
 
Unit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUnit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdf
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
AWS Summit Auckland - Moving MS .NET Applications One Container at a Time
AWS Summit Auckland - Moving MS .NET Applications One Container at a TimeAWS Summit Auckland - Moving MS .NET Applications One Container at a Time
AWS Summit Auckland - Moving MS .NET Applications One Container at a Time
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
 
The seven pillars of aspnet
The seven pillars of aspnetThe seven pillars of aspnet
The seven pillars of aspnet
 
Learn the java basic programming with example and syntaxchapter1-part-b.pptx
Learn the java basic programming with example and syntaxchapter1-part-b.pptxLearn the java basic programming with example and syntaxchapter1-part-b.pptx
Learn the java basic programming with example and syntaxchapter1-part-b.pptx
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop App
 
Csc153 chapter 01
Csc153 chapter 01Csc153 chapter 01
Csc153 chapter 01
 
Part i
Part iPart i
Part i
 
The Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.NetThe Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.Net
 
CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)
 
Accelerating time to delivery - Modern tools for COBOL development
Accelerating time to delivery - Modern tools for COBOL developmentAccelerating time to delivery - Modern tools for COBOL development
Accelerating time to delivery - Modern tools for COBOL development
 
A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0
A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0
A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0
 
Moving microsoft .net applications one container at a time
 Moving microsoft .net applications one container at a time  Moving microsoft .net applications one container at a time
Moving microsoft .net applications one container at a time
 
Intro1
Intro1Intro1
Intro1
 
Microsoft C# programming basics
Microsoft C# programming basics  Microsoft C# programming basics
Microsoft C# programming basics
 
Event Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdfEvent Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdf
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)
 

Recently uploaded

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 

LECTURE 1 - Introduction to Programming.pptx

  • 1. LECTURE 1: Introduction to Programming CODE &TITLE: CS 2104 Visual Programming LECTURER :MR. AKRAM ALI OMAR EMAIL: akram.ali.omar@gmail.com Mobile: 0778695626 1
  • 2. Content  What is Computer Programming?  Your First C# Program  What is C#?  What is .NET Framework?  What is Visual Studio?  Compiling, Running and Debugging C# Programs  What is MSDN Library? 2
  • 3. Define: Computer Programming Google Definition Computer programming: creating a sequence of instructions to enable the computer to do something 3
  • 4.  Define a task / problem  Plan your solution  Find suitable algorithm / data structures to use  Find suitable libraries / platforms / frameworks  Write source code (step by step)  Fix program errors (bugs)  Install, configure and run the software  Fix / improve the software over the time Software Development Phases 4 = Specification = Architecture / Design = Implementation = Testing & Debugging = Deployment = Maintenance
  • 5. What is "C#"?  C# is a modern programming language  A syntax that allows to give instructions to the computer  C# features:  Extremely powerful  Easy to learn  Easy to read and understand  Object-oriented  Functional programming features 5
  • 6. What You Need to Program?  A programming language  C#  Problem to solve  IDE, compilers, SDK  Visual Studio, .NET Framework SDK  Set of useful standard classes  Microsoft .NET Framework FCL  Help documentation  MSDN Library 6
  • 7. Your First C# Program using System; class HelloCSharp { static void Main() { Console.WriteLine("Hello, C#"); } } 7
  • 8. C# Code – How It Works? using System; class HelloCSharp { static void Main() { Console.WriteLine("Hello, C#"); } } 8 Include the standard .NET namespace "System" Define a class called "HelloCSharp" Define the Main() method – the program entry point Print a text on the console by calling the method "WriteLine" of the class "Console"
  • 9. The C# Code Should Be Well Formatted using System; class HelloCSharp { static void Main() { Console.WriteLine("Hello, C#"); } } 9 Class names should use PascalCase and start with a CAPITAL letter The { symbol should be alone on a new line. The } symbol should be under the corresponding {. The block after the { symbol should be indented by a TAB.
  • 10. Example of Bad Code Formatting 10 using System ; Class HelloCSharp { static void Main( ) { Console . WriteLine ("Hello, C#" ) ; Console. WriteLine ( "Hello again" ) ;} } Such formatting makes the source code unreadable
  • 11. What is .NET Framework? 11
  • 12. What is .NET Framework?  Environment for execution of .NET programs (CLR)  Powerful library of classes (FCL)  Common execution engine for many programming languages  C#  Visual Basic .NET  Managed C++  ... and many others 12
  • 13. The building blocks of .NET Framework 13
  • 14. CLR – The Heart of .NET Framework  Common Language Runtime (CLR)  Managed execution environment (virtual machine)  Executes .NET applications  Controls the execution process  Automatic memory management (garbage collection)  Programming languages integration  Multiple versions support for assemblies  Exception Handling 14
  • 15. Framework Class Library  Framework Class Library (FCL)  Provides basic classes for developers:  Console applications  Web applications and web services  XAML, WPF, Silverlight rich-media applications  Windows Forms and WPF GUI applications  Windows Store applications  Database applications  Applications for mobile devices 15
  • 16. What is Visual Studio? 16
  • 17. Visual Studio • Visual Studio – Integrated Development Environment (IDE) • Development tool that helps us to:  Write code  Design user interface  Compile code  Execute / test / debug applications  Browse the help  Manage project's files 17
  • 18. Benefits of Visual Studio • Single tool for:  Writing code in many languages (C#, VB.NET, Python, …)  Using different technologies (Web Forms, MVC, WPF, EF, WCF, …)  For different platforms (Win8, Silverlight, Windows Phone, …) • Full integration of most development activities (coding, compiling, testing, debugging, deployment, version control, ...) • Very easy to use! 18
  • 19. Visual Studio – Example 19
  • 20. Visual Studio Compiling, Running and Debugging C# Programs 20
  • 21. Creating New Console Application 1. File  New  Project ... 2. Choose Visual C#  Console Application 3. Choose project directory and name 21
  • 22. Creating New Console Application (2) 22 4. Visual Studio creates some source code for you Namespace not required Class name should be changed Most imports are not required File name should be changed
  • 23. Compiling the Source Code • The process of compiling includes:  Syntactic checks  Type safety checks  Translation of the source code to lower level language (MSIL)  Creating executable files (assemblies) • You can start compilation by  Using Build->Build Solution/Project  Pressing [F6] or [Shift+Ctrl+B] 23
  • 24. Running Programs • The process of running application includes:  Compiling (if project not compiled)  Starting the application • You can run application by:  Using Debug->Start menu  By pressing [F5] or [Ctrl+F5] • * NOTE: Not all types of projects are able to be started! 24
  • 25. Debugging The Code • The process of debugging application includes:  Spotting an error  Finding the lines of code that cause the error  Fixing the error in the code  Testing to check if the error is gone and no new errors are introduced • Iterative and continuous process • Debuggers help a lot 25
  • 26. Debugging in Visual Studio • Visual Studio has a built-in debugger • It provides:  Breakpoints  Ability to trace the code execution  Ability to inspect variables at runtime 26
  • 27. Visual Studio Blank Solution Creating a Solution without any Projects 27
  • 28. What Is a Blank Solution? • A Visual Studio blank solution  Solution with no projects in it  Projects to be added later • Why we need a blank solution in Visual Studio?  First create a blank solution for your homework  Then create a project for each assignment from the homework 28
  • 29. Creating a Blank Solution in Visual Studio 29
  • 30. What is MSDN Library? 30
  • 31. What is MSDN Library? • Complete documentation of all classes and their functionality  With descriptions of all methods, properties, events, etc.  With code examples  For all Microsoft technologies • Related articles • Library of samples • MSDN Library is available at msdn.microsoft.com/library 31
  • 32. How to Use MSDN Library? 32  Search in Google for certain class / method / property  E.g.  Or  Or  Use Visual Studio's built-in help system  Press [F1] in Visual Studio in the code  Browse http://msdn.microsoft.com Press [F1] to view the documentation
  • 33. MSDN Library • Browsing the Documentation – Live Demo 33
  • 34. Summary • Programming: creating a sequence of instructions (source code) • C#: modern programming language, easy to learn • C# programs: class + main method + code in it • .NET Framework – a modern platform for software development by Microsoft • Visual Studio – powerful IDE for .NET developers: write / compile / execute / debug code • MSDN Library – the C# and .NET documentation 34