Module 1 Introducing C# and the.NET Framework. Module Overview Introduction to the.NET Framework 4 Creating Projects Within Visual Studio 2010 Writing.

Slides:



Advertisements
Similar presentations
Module 1: Creating an Application by Using Windows Presentation Foundation Overview of WPF Creating a Simple WPF Application Handling Events and Commands.
Advertisements

Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
.NET Framework Overview Pingping Ma Nov 16 th, 2006.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
The Microsoft View: Module 1: Getting Started. Copyright Course 2559B, Introduction to Visual Basic®.NET Programming with Microsoft®.NET. Lecture 1 Microsoft.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
Introduction to the C# Programming Language for the VB Programmer.
C# Programming: From Problem Analysis to Program Design1 2 Your First C# Program C# Programming: From Problem Analysis to Program Design 2 nd Edition.
Introduction to Computing and Programming
C# Programming: From Problem Analysis to Program Design1 2 Your First C# Program.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Copyright © 2012 Pearson Education, Inc. Chapter 2 Introduction to Visual C#
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
Tahir Nawaz Visual Programming C# Week 2. What is C#? C# (pronounced "C sharp") is an object- oriented language that is used to build applications for.
Creating a Console Application with Visual Studio
The Visual Studio. NET and VB
Module 15 Configuring and Deploying Windows Client Applications.
Getting Started Example ICS2O curriculum
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
Microsoft Visual Basic 2012 CHAPTER ONE Introduction to Visual Basic 2012 Programming.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
Creating and Running Your First C# Program Telerik Software Academy Telerik School Academy.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
1 Integrated Development Environment Building Your First Project (A Step-By-Step Approach)
McGraw-Hill© 2007 The McGraw-Hill Companies, Inc. All rights reserved. 1-1.
A First Program Using C#
Introduction to.Net and ASP.Net Course Introduction Build Your Own ASP.Net Website: Chapter 1 Microsoft ASP.Net Walkthrough: Creating a Basic Web Forms.
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Introduction to Programming
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
Module 1: Introduction to C# Module 2: Variables and Data Types
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
Microsoft Visual Basic 2005: Reloaded Second Edition
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
C# B 1 CSC 298 Writing a C# application. C# B 2 A first C# application // Display Hello, world on the screen public class HelloWorld { public static void.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC BUILDING BLOCKS Bilal Munir Mughal 1 Chapter-5.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Lecture 1 Programming in C# Introducing C# Writing a C# Program.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Lecture Set 2 Part B – Configuring Visual Studio; Configuration Options and The Help System (scan quickly for future reference)
Lecture Set 1 Part C: Understanding Visual Studio and.NET – Applications, Solutions, Projects (no longer used – embedded in Lecture Set 2A)
Programming in C#. I. Introduction C# (or C-Sharp) is a programming language. C# is used to write software that runs on the.NET Framework. Although C#
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
Module 2 Introduction to Visual Studio 2010 and WPF Version 4.
Module 1: Getting Started. Introduction to.NET and the.NET Framework Exploring Visual Studio.NET Creating a Windows Application Project Overview Use Visual.
1.
Module 3 Designing and Developing a User Interface.
Module 4 Taking Control of the User Interface. Module Overview Sharing Logical Resources in an Application Creating Consistent User Interfaces by Using.
Creating a Java Application and Applet
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
INTRODUCTION BEGINNING C#. C# AND THE.NET RUNTIME AND LIBRARIES The C# compiler compiles and convert C# programs. NET Common Language Runtime (CLR) executes.
IS 350 Course Introduction. Slide 2 Objectives Identify the steps performed in the software development life cycle Describe selected tools used to design.
Introduction to Visual Basic 2008 Programming
Module 0: Introduction Chapter 2: Getting Started
Module 1: Getting Started
Web Development in Microsoft Visual Studio 2013
C# Programming: From Problem Analysis to Program Design
Social Media And Global Computing Introduction to Visual Studio
IS 135 Business Programming
Presentation transcript:

Module 1 Introducing C# and the.NET Framework

Module Overview Introduction to the.NET Framework 4 Creating Projects Within Visual Studio 2010 Writing a C# Application Building a Graphical Application Documenting an Application Debugging Applications By Using Visual Studio 2010

Lesson 1: Introduction to the.NET Framework 4 What Is the.NET Framework 4? The Purpose of Visual C# What Is an Assembly? How the Common Language Runtime Loads, Compiles, and Runs Assemblies What Tools Does the.NET Framework Provide?

What Is the.NET Framework 4? Common Language Runtime Class Library Development Frameworks

The Purpose of Visual C# C# has been standardized and is described by the ECMA- 334 C# Language Specification C# uses a very similar syntax to C, C++, and Java C# is the language of choice for many developers who build.NET Framework applications C#

What Is an Assembly? MyAssembly.dll OR.exe Building blocks of.NET Framework applications Collection of types and resources that form a logical unit of functionality MyClassA MyClassB MyResource V Assembly version... Assembly signed with a digital certificate

How the Common Language Runtime Loads, Compiles, and Runs Assemblies Loads assemblies that the application references Verifies and compiles assemblies into machine code Runs the executable assembly Assemblies contain MSIL code, which is not actually executable The CLR loads the MSIL code from an assembly and converts it into the machine code that the computer requires

What Tools Does the.NET Framework Provide? Makecert.exe Caspol.exe Gacutil.exe Ngen.exe Ildasm.exe Sn.exe

Lesson 2: Creating Projects Within Visual Studio 2010 Key Features of Visual Studio 2010 Templates in Visual Studio 2010 The Structure of Visual Studio Projects and Solutions Creating a.NET Framework Application Building and Running a.NET Framework Application Demonstration: Disassembling a.NET Framework Assembly

Key Features of Visual Studio 2010 Visual Studio 2010: Intuitive IDE that enables developers to quickly build applications in their chosen programming language Visual Studio 2010 features: Rapid application development Server and data access Debugging features Error handling Help and documentation Rapid application development Server and data access Debugging features Error handling Help and documentation

Templates in Visual Studio 2010 Windows Forms Application Console Application Class Library ASP.NET Web Application WCF Service Application ASP.NET MVC 2 Application Silverlight Application WPF Application

The Structure of Visual Studio Projects and Solutions Visual Studio Solution Visual Studio solutions are wrappers for.NET projects Visual Studio solutions can contain multiple.NET projects Visual Studio solutions can contain different types of.NET projects ASP.NET project.aspx.aspx.cs.config.csproj WPF project.xaml.xaml.cs.config.csproj Console project.cs.config.csproj

Creating a.NET Framework Application Open Visual Studio 2010 On the File menu, click New, and then click Project In the New Project dialog box, specify the following, and then click OK: - Project template - Project name - Project save path In the New Project dialog box, specify the following, and then click OK: - Project template - Project name - Project save path Programmer productivity features include: IntelliSense Code snippets

Building and Running a.NET Framework Application Visual Studio In Visual Studio 2010, on the Build menu, click Build Solution On the Debug menu, click Start Debugging Command line csc.exe /t:exe /out:" C:\Users\Student\Documents\Visual Studio 2010\MyProject\myApplication.exe" "C:\Users\Student\Documents\Visual Studio 2010\MyProject\*.cs"

Demonstration: Disassembling a.NET Framework Assembly In this demonstration, you will: Run an existing.NET Framework application Open Ildasm Disassemble an existing.NET Framework assembly Examine the disassembled.NET Framework assembly

Notes Page Over-flow Slide. Do Not Print Slide. See Notes pane.

Lesson 3: Writing a C# Application What Are Classes and Namespaces? The Structure of a Console Application Performing Input and Output by Using a Console Application Best Practices for Commenting C# Applications

What Are Classes and Namespaces? System.IO namespace A class is essentially a blueprint that defines the characteristics of an entity A class is essentially a blueprint that defines the characteristics of an entity A namespace represents a logical collection of classes File class Path class DirectoryInfo class Directory class FileInfo class

The Structure of a Console Application using System; namespace MyFirstApplication { class Program { static void Main(string[] args) { } using System; namespace MyFirstApplication { class Program { static void Main(string[] args) { } Bring System namespace into scope Program class declaration Main method declaration Namespace declaration

Performing Input and Output by Using a Console Application ReadLine() Clear() ReadKey() Write() WriteLine() Read() System.Console method includes: using System;... Console.WriteLine("Hello there!“); using System;... Console.WriteLine("Hello there!“);

Best Practices for Commenting C# Applications // This is a comment on a separate line. string message = "Hello there!"; // This is an inline comment. // This is a comment on a separate line. string message = "Hello there!"; // This is an inline comment. Begin procedures by using a comment block In longer procedures, use comments to break up units of work In longer procedures, use comments to break up units of work When you declare variables, use a comment to indicate how the variable will be used When you declare variables, use a comment to indicate how the variable will be used When you write a decision structure, use a comment to indicate how the decision is made and what it implies When you write a decision structure, use a comment to indicate how the decision is made and what it implies

Lesson 4: Building a Graphical Application What Is WPF? The Structure of a WPF Application The WPF Control Library WPF Events Building a Simple WPF Application Demonstration: Building a Simple WPF Application

What Is WPF? WPF is a new foundation for building Windows-based applications by combining: Media Documents Graphical user interface Features of WPF Ease of user interface design Extensive support for client application development Use of XAML Support for interoperability with older applications

The Structure of a WPF Application <Window x:Class="WpfApplication1.MainWindow” xmlns=“..“ xmlns:x=“.." Title="MainWindow" Height="350" Width="525"> <Window x:Class="WpfApplication1.MainWindow” xmlns=“..“ xmlns:x=“.." Title="MainWindow" Height="350" Width="525"> Declarative XAML file namespace WpfApplication1 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } namespace WpfApplication1 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } Code-behind Visual C# file

The WPF Control Library Button WPF controls include: Canvas ComboBox Grid Label StackPanel TextBox <Button Name="myButton" BorderBrush="Black" BorderThickness="1" Click="myButtonOnClick" ClickMode="Press"> Click Me <Button Name="myButton" BorderBrush="Black" BorderThickness="1" Click="myButtonOnClick" ClickMode="Press"> Click Me Button example:

WPF Events ClickMe Button definition private void myButton_Click(object sender, RoutedEventArgs e) { // Code to do something goes here. } private void myButton_Click(object sender, RoutedEventArgs e) { // Code to do something goes here. } Event handler Using WPF, you create event-driven applications, for example, responding to a button being clicked, item selections, and so on

Building a Simple WPF Application Visual Studio enables you to: Create a new WPF application Add controls to the WPF application Set control properties Add event handlers to controls Add code to implement business logic

Demonstration: Building a Simple WPF Application In this demonstration, you will: Create a new WPF application Add controls to the WPF application Set the properties for the controls Add code to the application Build and run the application

Notes Page Over-flow Slide. Do Not Print Slide. See Notes pane.

Lesson 5: Documenting an Application What Are XML Comments? Common XML Comment Tags Generating Documentation from XML Comments

What Are XML Comments? /// The Hello class prints a greeting on the screen /// public class Hello { /// We use console-based I/O. For more information /// about /// WriteLine, see /// public static void Main( ) { Console.WriteLine("Hello World"); } /// The Hello class prints a greeting on the screen /// public class Hello { /// We use console-based I/O. For more information /// about /// WriteLine, see /// public static void Main( ) { Console.WriteLine("Hello World"); } Use XML comments to generate Help documentation for your applications Use XML comments to generate Help documentation for your applications

Common XML Comment Tags Common tags include : …

Generating Documentation from XML Comments Generate an XML file from Visual Studio 2010 Generate an XML file from csc.exe MyProject The Hello class prints a greeting on the screen... MyProject The Hello class prints a greeting on the screen... Consume the XML file in Sandcastle Help File Builder

Lesson 6: Debugging Applications by Using Visual Studio 2010 Debugging in Visual Studio 2010 Using Breakpoints Stepping Through and Over Code Using the Debug Windows

Debugging in Visual Studio 2010 Debugging is an essential part of application development Visual Studio 2010 provides several tools to help you debug code Visual Studio 2010 provides several tools to help you debug code Step Out Step Over Step Into Restart Stop Debugging Break AllStart Debugging

Using Breakpoints When you run an application in Debug mode, you can pause execution and enter break mode When you run an application in Debug mode, you can pause execution and enter break mode Visual Studio 2010 enables you to: Locate a specific line of code and set a breakpoint Locate a breakpoint and disable it Locate a breakpoint and remove it

Stepping Through and Over Code You can step through code one statement at a time to see exactly how processing proceeds through your application You can step through code one statement at a time to see exactly how processing proceeds through your application Visual Studio 2010 enables you to: Step into the current statement Step over the current statement Step out of the current statement

Using the Debug Windows Visual Studio 2010 includes several windows that you can use to help debug your applications Visual Studio 2010 includes several windows that you can use to help debug your applications Locals Output Memory Processes Modules Call Stack QuickWatch Threads Immediate

Exercise 1: Building a Simple Console Application Exercise 2: Building a WPF Application Exercise 3: Verifying the Application Exercise 4: Generating Documentation for an Application Logon information Estimated time: 60 minutes Lab: Introducing C# and the.NET Framework

Lab Scenario

Lab Review Review Questions What methods did you use to capture and display information in your console application? What event did you handle on the Format Data button in your WPF application? What debugging functions did you use when you verified the application? How do you instruct Visual Studio 2010 to produce an XML file that contains XML comments?

Module Review and Takeaways Review Questions Best Practices Tools

Notes Page Over-flow Slide. Do Not Print Slide. See Notes pane.