An Introduction to C# and the .NET Framework

Slides:



Advertisements
Similar presentations
What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word processor), it must be given the instructions.
Advertisements

Introduction to .NET Framework
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Windows Software Development Lecture 15 MIS233 Instructor – Larry Langellier.
CIM2564 Introduction to Development Frameworks 1 Overview of a Development Framework Topic 1.
 2009 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and Visual C#
 2002 Prentice Hall. All rights reserved. 1 Outline 3.1Introduction 3.2Simple Program: Printing a Line of Text 3.3Another Simple Program: Adding Integers.
Introduction to the C# Programming Language for the VB Programmer.
Introduction to.NET Microsoft announced in June 2000 A new software –development model that allows applications created in disparate programming languages.
ISYS 512 Business Application Design and Development with.Net David Chao.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
 2002 Prentice Hall. All rights reserved. 1 Chapter 1 – Introduction to Computers, Internet and Visual Basic.NET Outline 1.1Introduction 1.2What is a.
Introduction to VB.Net ITE-370. What is.NET? A brand of Microsoft technologies A platform for creating distributed Web applications A combination of new.
Intro to dot Net Dr. John Abraham UTPA – Fall 09 CSCI 3327.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Rajeswari Indupuri Introduction to.NET Framework.
Microsoft Visual Basic 2012 CHAPTER ONE Introduction to Visual Basic 2012 Programming.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
Creating and Running Your First C# Program Telerik Software Academy Telerik School Academy.
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
Introduction 01_intro.ppt
A First Program Using C#
1 Introduction to.NET Framework. 2.NETFramework Internet COM+ Orchestration Orchestration Windows.NET Enterprise ServersBuildingBlockServices Visual Studio.NET.
Introduction to .Net Framework
1 8/29/05CS360 Windows Programming Professor Shereen Khoja.
High thoughts must have high language. Aristophanes
Architecture of.NET Framework .NET Framework ٭ Microsoft.NET (pronounced “dot net”) is a software component that runs on the Windows operating.
Module 1: Introduction to C# Module 2: Variables and Data Types
 2002 Prentice Hall. All rights reserved. 1 Introduction to Visual Basic.NET,.NET Framework and Visual Studio.NET Outline 1.7Introduction to Visual Basic.NET.
 2002 Prentice Hall. All rights reserved. 1 Chapter 1 – Introduction to Computers, the Internet, the Web and C# Outline 1.7 C, C++, Visual Basic.NET and.
Introduction to Microsoft.Net Session 01 Mata kuliah: M0874 – Programming II Tahun: 2010.
Introduction to.NET Framework. .NET – What Is It? Software platform Language neutral In other words:.NET is not a language (Runtime and a library for.
Microsoft Visual Basic 2005: Reloaded Second Edition
Introduction to .NET Rui Ye.
Lecture Set 1 Part B: Understanding Visual Studio and.NET – Structure and Terminology 1/16/ :04 PM.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
 2002 Prentice Hall. All rights reserved. 1 Lecture 1 Consolidation of first year work (part 1) Read all the chapters on your own Slides highlight important.
CIS 375—Web App Dev II Microsoft’s.NET. 2 Introduction to.NET Steve Ballmer (January 2000): Steve Ballmer "Delivering an Internet-based platform of Next.
Chapter 3 – Introduction to Visual Basic Programming
Advanced Programming LOOP.
Computing with C# and the.NET Framework Chapter 1 An Introduction to Computing with C# ©2003, 2011 Art Gittleman.
ISYS 573 Special Topic – VB.Net David Chao. The History of VB Early 1960s:BASIC-Beginner’s All-Purpose Symbolic Instruction Code –Teaching –Simple syntax,
2. Introduction to the Visual Studio.NET IDE. Chapter Outline Overview of the Visual Studio.NET IDE Overview of the Visual Studio.NET IDE Menu Bar and.
1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.
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#
Introduction to .NET Framework
Introduction to VB.Net. What is.NET? A brand of Microsoft technologies A platform for creating distributed Web applications A combination of new and updated.
Introduction to Visual Basic Programming Introduction to Visual Basic Programming Ch3 – Deitel’s Book.
Module 1: Getting Started. Introduction to.NET and the.NET Framework Exploring Visual Studio.NET Creating a Windows Application Project Overview Use Visual.
1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.
Intro to dot Net Dr. John Abraham UTPA CSCI 3327.
Chapters 2 & 3. .NET Software development model that allows applications created in disparate programming languages to communicate Universal data access.
Microsoft .NET A platform that can be used for building and running windows and web applications such that the software is platform and device-independent.
Getting Started with.NET Getting Started with.NET/Lesson 1/Slide 1 of 31 Objectives In this lesson, you will learn to: *Identify the components of the.NET.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 – Introduction to C# Programming Outline 3.1 Introduction 3.2 Simple Program: Printing a Line.
Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing a Line of Text in a Web Page 7.3 Another JavaScript.
Text Introduction to.NET Framework. CONFIDENTIAL Agenda .NET Training – Purpose  What is.NET?  Why.NET?  Advantages  Architecture  Components: CLR,
Lecture Set 1 Part B: Understanding Visual Studio and.NET – Structure and Terminology 1/16/ :04 PM.
Microsoft Visual Basic 2015 CHAPTER ONE Introduction to Visual Basic 2015 Programming.
Introduction to Visual Basic. NET,. NET Framework and Visual Studio
Introduction to Visual Basic 2008 Programming
C# and the .NET Framework
Introduction to .NET Framework Ch2 – Deitel’s Book
Java programming lecture one
Advanced Programming Lecture 02: Introduction to C# Apps
Chapter 3 – Introduction to C# Programming
IS 135 Business Programming
Presentation transcript:

An Introduction to C# and the .NET Framework

A Workshop Presented by Dr. Stewart B. Carpenter and Dr A Workshop Presented by Dr. Stewart B. Carpenter and Dr. Catherine Stringfellow

Workshop Outline Introduction to .NET Introduction to .NET IDE C# console application Differences in C# and C++ Break C# Windows Application (SDI) C# Windows Application (MDI)

References Deitel, H., Deitel, P., et al., C#, How to Program, Prentice-Hall, Upper Saddle River, NJ Foxall, J. and Haro-Chun, W., SAMS Teach Yourself C# in 24 Hours, SAMS, Indianapolis, IN Turtschi, A., et al., C# .NET Web Developer’s Guide, Syngress, electronic volume at www.netlibrary.com Workshop slides and tutorial materials can be downloaded from: http://cs.mwsu.edu/~stringfe/CCSCWorkshop

.NET and C# .NET Platform Web-based applications can be distributed to a variety of devices and desktops C# developed specifically for .NET

Introduction to Microsoft .NET .NET initiative Introduced by Microsoft (June 2000) Vision for embracing the Internet in software development Independence from specific language or platform Applications developed in any .NET-compatible language Visual Basic.NET, Visual C++.NET, C# and more Supports portability and interoperability Architecture capable of existing on multiple platforms Supports portability

Microsoft .NET Key components of .NET Web services Applications used over the Internet Software reusability Web services provide solutions for variety of companies Cheaper than one-time solutions that can’t be reused Single applications perform all operations for a company via various Web services Manage taxes, bills, investments and more Pre-packaged components using Visual Programming (buttons, text boxes, scroll bars) Make application development quicker and easier

Microsoft .NET Keys to interaction XML (Extreme Markup Language) and SOAP (Simple Object Access Protocol) “Glue” that combines various Web services to form applications XML gives meaning to data SOAP allows communication to occur easily

Microsoft .NET Other concepts Universal data access Eliminates need to synchronize files Synchronization - Updating multiple copies of same file to the most recent Data resides at one central location Accessible by anyone with connection and proper authorization Data formatted appropriately for display on various devices Same document seen on PC, PDA, cell phone and other devices

.NET Framework and the Common Language Runtime Heart of .NET strategy Manages and executes applications and Web services Provides security, memory management and other programming capabilities Includes Framework Class Library (FCL) Pre-packaged classes ready for reuse Used by any .NET language Details contained in Common Language Specification (CLS) Submitted to European Computer Manufacturers Association to make the framework easily converted to other platforms Executes programs by Common Language Runtime (CLR)

Common Language Runtime (CLR) Central part of framework Executes programs Compilation process Two compilations take place Programs compiled to Microsoft Intermediate Language (MSIL) Defines instructions for CLR MSIL code translated into machine code Platform-specific machine language

Common Language Runtime (CLR) Why two compilations? Platform independence .NET Framework can be installed on different platforms Execute .NET programs without any modifications to code .NET compliant program translated into platform independent MSIL Language independence MSIL form of .NET programs not tied to particular language Programs may consist of several .NET-compliant languages Old and new components can be integrated MSIL translated into platform-specific code Other advantages of CLR Execution-management features Manages memory, security and other features Relieves programmer of many responsibilities More concentration on program logic

.NET and C# .NET platform C# Web-based applications can be distributed to variety of devices and desktops C# Developed specifically for .NET Enable programmers to migrate from C/C++ and Java easily Event-driven, fully OO, visual programming language Has IDE Process of rapidly creating an application using an IDE is called Rapid Application Development (RAD)

C# Language interoperability Can interact with software components written in different languages or with old packaged software written in C/C++ Can interact via internet, using industry standards (SOAP and XML) Simple Object Access Protocol - Helps to share program “chunks” over the internet Accommodates a new style of programming in which applications are created from building blocks available over internet (reusability)

C# and the .NET IDE Console applications No visual components (buttons, text boxes, etc.) Only text output Two types MS-DOS prompt -Used in Windows 95/98/ME Command prompt -Used in Windows 2000/NT/XP

Namespaces Group related C# features into categories Contain code that can be reused .NET framework library (FCL) contains many namespaces Must be referenced in order to be used Example: Console feature is in namespace System

Methods Building blocks of C# programs Every program is a class! The Main method Each console or windows application must have exactly one

Simple Program: Output

1 // 2 // Printing a line with multiple statements. 3 4 using System; 5 6 class Welcome2 7 { 8 static void Main( string[] args ) 9 { 10 Console.Write( "Welcome to " ); 11 Console.WriteLine( "C# Programming!" ); 12 } 13 }

Displaying output With C# Console applications Text output only Console.Write(“... {0}”, Sum); Console.WriteLine(“…”);

2 // Printing multiple lines in a dialog Box. 3 4 using System; 1 // 2 // Printing multiple lines in a dialog Box. 3 4 using System; 5 using System.Windows.Forms; 6 7 class Welcome4 8 { 9 static void Main( string[] args ) 10 { 11 MessageBox.Show(“Welcome\nto\nC#\nprogramming!" ); 12 } 13 } The System.Windows.Forms namespace allows the programmer to use the MessageBox class. This will display the contents in a message box as opposed to in the console window.

Adding a reference to an assembly in Visual Studio .NET Add Reference dialogue

Adding a reference to an assembly in Visual Studio .NET References folder Solution Explorer System.Windows.Forms reference

Dialog displayed by calling MessageBox.Show. OK button allows the user to dismiss the dialog. Dialog is automatically sized to accommodate its contents. Mouse cursor Close box

Getting input (string, int, double, char, long …15 types) Primitive data types built into C# (string, int, double, char, long …15 types) Console.ReadLine( ) Used to get a value from the user input Int32.Parse( ) Converts a string argument to an integer Allows math to be performed once the string is converted number2 = Int32.Parse( Console.ReadLine( ) );

1 // 2 // A first console program in C#. 3 4 using System; 5 6 class Welcome1 7 { 8 static void Main( string[] args ) 9 { 10 Console.WriteLine( "Welcome to C# Programming!" ); 11 } 12 }

1 // 2 // An addition program. 3 4 using System; 5 6 class Addition 7 { 8 static void Main( string[] args ) 9 { 10 string firstNumber, // first string entered by user 11 secondNumber; // second string entered by user 12 13 int number1, // first number to add 14 number2, // second number to add 15 sum; // sum of number1 and number2 16 17 // prompt for and read first number from user as string 18 Console.Write( "Please enter the first integer: " ); 19 firstNumber = Console.ReadLine();

21 // read second number from user as string 22 Console.Write( "\nPlease enter the second integer: " ); 23 secondNumber = Console.ReadLine(); 24 25 // convert numbers from type string to type int 26 number1 = Int32.Parse( firstNumber ); 27 number2 = Int32.Parse( secondNumber ); 28 29 // add numbers 30 sum = number1 + number2; 31 32 // display results 33 Console.WriteLine( "\nThe sum is {0}.", sum ); 34 35 } // end method Main 36 37 } // end class Addition

Combining steps 21 // read second number from user as string 22 Console.Write( "\nPlease enter the second integer: " ); 23 number2 = Int32.Parse( Console.ReadLine() );