Escolar Documentos
Profissional Documentos
Cultura Documentos
Programming
Creating and Running Your First C# Program
Svetlin Nakov
Telerik Corporation
www.telerik.com
1. What Table of Contents
is
Com
puter
Prog
ram
ming
?
2. Your
First
C#
Prog
ram 2
What is Computer
Programming?
Define: Computer Programming
4
Programming Phases
Define a task/problem = Specification
Plan your solution = Design
Find suitable algorithm to solve it
Find suitable data structures to use
Write code = Implementation
Fix program error (bugs)
= Testing & Debugging
Make your customer happy = Deployment
5
Your First C# Program
First Look at C#
Sample C# program:
using System;
class HelloCSharp
{
static void Main()
{
Console.WriteLine("Hello, C#");
}
}
7
C# Code – How It Works?
Include the standard Define a class called
namespace "System" "HelloCSharp"
class HelloCSharp {
static
void Main( ) { Console
. WriteLine ("Hello, C#" )
;Console.
WriteLine ( "Hello again"
) ;}}
10
What is "C#"?
Programming language
A syntax that allow to give instructions to the
computer
C# features:
New cutting edge language
Extremely powerful
Easy to learn
Easy to read and understand
Object-oriented
11
What You Need to Program?
Knowledge of a programming language
C#
Task to solve
Development environment, compilers, SDK
Visual Studio, .NET Framework SDK
Set of useful standard classes
Microsoft .NET Framework FCL
Help documentation
MSDN Library
12
Your First C# Program
Live Demo
What is .NET
Framework?
Enviro What is .NET Framework?
nmen
t for
execu
tion
of
.NET
progr
ams
Power
ful
library
of 15
Buildi Inside .NET Framework
ng
blocks
of
C# C++ VB.NET J# F# JScript Perl Delphi …
.NET
ASP.NET Windows
Frame
Web Forms, MVC, AJAX WPF Silverlight
Forms
work
Mobile Internet Toolkit
WCF and WWF (Communication and Workflow Tier) FCL
ADO.NET, LINQ and XML (Data Tier)
Base Class Library (BCL)
Common Language Runtime (CLR)
CLR
22
Visual Studio
Compiling, Running and Debugging C# Programs
1. File Creating New Console Application
New
Proje
ct ...
2. Choo
se C#
conso
le
appli
catio
n
24
4. Visua Creating New Console Application (2)
l
Studi
o
Namespace
creat Some imports
not required are not required
es
some
sourc Class name
e should be
code changed
for
you
25
The Compiling Source Code
proce
ss of
compi
ling
includ
es:
Synt
actic
chec
ks
Typ
e 26
The Running Programs
proce
ss of
runni
ng
applic
ation
includ
es:
Com
pilin
g (if
proj 27
Debugging The Code
The process of debugging
application includes:
Spotting an error
Finding the lines of code that
cause the error
Fixing the code
Testing to check if the error is
gone and no errors are introduced
Iterative and continuous process
28
Visual Debugging in Visual Studio
Studi
o has
built-
in
debug
ger
It
provid
es:
Brea
kpoi
nts 29
Visual Studio
Compiling, Running and Debugging C# Programs
Live Demo
Visual Studio
Blank Solution
Creating a Solution
Without Projects
What Is a Blank Solution?
A Visual Studio blank solution
Solution with no projects in it
Projects to be added later
What is the point?
Not making a project just to give proper name
And not working in this project
VS Blank Solution
33
Visual Studio
Blank Solution
Live Demo
What is MSDN
Library?
Compl What is MSDN Library?
ete
docu
ment
ation
of all
classe
s and
their
functi
onalit
y
Wit 36
MSDN Library
37
Offlin How to Use MSDN Library?
e
versio
n
Use
the
tabl
e of
cont
ents
Use
the
alph 38
MSDN Library
Browsing and Searching Documentation
Live Demo
Introduction to Programming
Questions?
http://academy.telerik.com
Exercises
1. Familiarize yourself with:
Microsoft Visual Studio
Microsoft Developer Network (MSDN) Library
Documentation
Find information about Console.WriteLine() method.
42
9.Write Exercises (3)
a
progr
am
that
prints
the
first
10
mem
bers
of the
seque
nce:
*NOTE:
2, -3, If you have any difficulties, search in Google. 43