Your SlideShare is downloading. ×
1. Introduction To Programming - C# Fundamentals
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

1. Introduction To Programming - C# Fundamentals

1,302
views

Published on

C# Programming Fundamentals Course @ Telerik Academy …

C# Programming Fundamentals Course @ Telerik Academy
http://academy.telerik.com
This presentation introduces you to the world of programming. You will learn what C# is all about, what is a program, how to write one, what tools and resources you can use and you will write your first program!
Main points:
.Net Framework
Visual Studio
Debugging
MSDN Library
Your first real program

Published in: Education, Technology

0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,302
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
180
Comments
0
Likes
5
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Introduction to Programming Creating and Running Your First C# ProgramSvetlin NakovManager Technical Traininghttp://nakov.comTelerik Software Academyacademy.telerik.com
  • 2. Table of Contents1. What is Computer Programming?2. Your First C# Program3. What is .NET Framework?4. What is Visual Studio?5. What is MSDN Library? 2
  • 3. What is Computer Programming?
  • 4. Define: Computer ProgrammingComputer programming: creating asequence of instructions to enable thecomputer to do something Definition by Google 4
  • 5. 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
  • 6. Your First C# Program
  • 7. First Look at C#Sample C# program:using System;class HelloCSharp{ static void Main() { Console.WriteLine("Hello, C#"); }} 7
  • 8. C# Code – How It Works?Include the standard Define a class callednamespace "System" "HelloCSharp" using System; Define the Main() class HelloCSharp method – the { program entry point static void Main() { Console.WriteLine("Hello, C#"); } } Print a text on the console by calling the method "WriteLine" of the class "Console" 8
  • 9. C# Code Should Be Well Formatted Class names should use PascalCase and start with a CAPITAL letter.using System;class HelloCSharp The { symbol should{ be alone on a new line. static void Main() { Console.WriteLine("Hello, C#"); }}The } symbol should The block after the be under the { symbol should be corresponding {. indented by a TAB. 9
  • 10. Example of Bad Formatting Such formatting makes the source code unreadable. usingSystem ; class HelloCSharp { staticvoid Main( ) { Console. WriteLine ("Hello, C#" ) ;Console. WriteLine ( "Hello again" ) ;}} 10
  • 11. 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
  • 12. 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
  • 13. Your First C# Program Live Demo
  • 14. What is .NETFramework?
  • 15. What is .NET Framework? Environment for execution of .NET programs Powerful library of classes Programming model Common execution engine for many programming languages  C#  Visual Basic .NET  Managed C++  ... and many others 15
  • 16. Inside .NET Framework Building blocks of .NET Framework C# C++ VB.NET J# F# JScript Perl Delphi … ASP.NET Windows Web Forms, MVC, AJAX WPF Silverlight Mobile Internet Toolkit Forms WCF and WWF (Communication and Workflow Tier) FCL ADO.NET, LINQ and XML (Data Tier) Base Class Library (BCL) CLR Common Language Runtime (CLR) Operating System (OS) 16
  • 17. CLR – The Heart of .NET Framework Common Language Runtime (CLR)  Managed execution environment  Executes .NET applications CLR  Controls the execution process  Automatic memory management (garbage collection)  Programming languages integration  Multiple versions support for assemblies  Integrated type safety and security 17
  • 18. Framework Class Library Framework Class Library (FCL)  Provides basic functionality to developers:  Console applications  WPF and Silverlight rich-media applications  Windows Forms GUI applications  Web applications (dynamic Web sites)  Web services, communication and workflow  Server & desktop applications  Applications for mobile devices 18
  • 19. What is Visual Studio?
  • 20. 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 projects files 20
  • 21. Benefits of Visual Studio Single tool for:  Writing code in many languages (C#, VB, …)  Using different technologies (Web, WPF, …)  For different platforms (.NET CF, Silverlight, …) Full integration of most development activities (coding, compiling, testing, debugging, deployment, version control, ...) Very easy to use! 21
  • 22. Visual Studio – Example 22
  • 23. Visual StudioCompiling, Running and Debugging C# Programs
  • 24. Creating New Console Application1. File  New  Project ...2. Choose C# console application3. Choose project directory and name 24
  • 25. Creating New Console Application (2)4. Visual Studio creates some source code for you Namespace Some imports not required are not required Class name should be changed 25
  • 26. Compiling Source Code The process of compiling includes:  Syntactic checks  Type safety checks  Translation of the source code to lower level language (MSIL)  Creating of executable files (assemblies) You can start compilation by  Using Build->Build Solution/Project  Pressing [F6] or [Shift+Ctrl+B] 26
  • 27. 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! 27
  • 28. 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
  • 29. Debugging in Visual Studio Visual Studio has built-in debugger It provides:  Breakpoints  Ability to trace the code execution  Ability to inspect variables at runtime 29
  • 30. Visual StudioCompiling, Running and Debugging C# Programs Live Demo
  • 31. Visual StudioBlank Solution Creating a Solution Without Projects
  • 32. 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
  • 33. VS Blank Solution 33
  • 34. Visual StudioBlank Solution Live Demo
  • 35. What is MSDN Library?
  • 36. What is MSDN Library? Complete documentation of all classes and their functionality  With descriptions of all methods, properties, events, etc.  With code examples Related articles Library of samples Use local copy or the Web version at http://msdn.microsoft.com/ 36
  • 37. MSDN Library 37
  • 38. How to Use MSDN Library? Offline version  Use the table of contents  Use the alphabetical index  Search for phrase or keyword  Filter by technology  Browse your favorite articles Online version  Use the built-in search 38
  • 39. MSDN LibraryBrowsing and Searching Documentation Live Demo
  • 40. Introduction to Programming курсове и уроци по програмиране, уеб дизайн – безплатно BG Coder - онлайн състезателна система - online judge курсове и уроци по програмиране – Телерик академия форум програмиране, форум уеб дизайн уроци по програмиране и уеб дизайн за ученици ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NET http://academy.telerik.com програмиране за деца – безплатни курсове и уроци ASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC безплатен SEO курс - оптимизация за търсачки алго академия – състезателно програмиране, състезаниякурсове и уроци по програмиране, книги – безплатно от Наков курс мобилни приложения с iPhone, Android, WP7, PhoneGap уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop Дончо Минков - сайт за програмиране free C# book, безплатна книга C#, книга Java, книга C# Николай Костов - блог за програмиране безплатен курс "Качествен програмен код" безплатен курс "Разработка на софтуер в cloud среда" C# курс, програмиране, безплатно
  • 41. Exercises1. Familiarize yourself with:  Microsoft Visual Studio  Microsoft Developer Network (MSDN) Library Documentation  Find information about Console.WriteLine() method.2. Create, compile and run a “Hello C#” console application.3. Modify the application to print your name.4. Write a program to print the numbers 1, 101 and 1001. 41
  • 42. Exercises (2)5. Install at home: 1. Microsoft .NET Framework 2. Microsoft Visual Studio (or Visual C# Express) 3. Microsoft Developer Network (MSDN)6. Create console application that prints your first and last name.7. Create a console application that prints the current date and time.8. Create a console application that calculates and prints the square of the number 12345. 42
  • 43. Exercises (3)9. Write a program that prints the first 10 members of the sequence: 2, -3, 4, -5, 6, -7, ...10. Provide a short list with information about the most popular programming languages. How do they differ from C#?11. Describe the difference between C# and .NET Framework.12. * Write a program to read your age from the console and print how old you will be after 10 years. *NOTE: If you have any difficulties, search in Google. 43
  • 44. Free Trainings @ Telerik Academy Fundamentals of C# Programming Course  csharpfundamentals.telerik.com Telerik Software Academy  academy.telerik.com Telerik Academy @ Facebook  facebook.com/TelerikAcademy Telerik Software Academy Forums  forums.academy.telerik.com