Module 1: Introduction to C# Module 2: Variables and Data Types

Slides:



Advertisements
Similar presentations
Module 6: Introduction to C Language ITEI102 Introduction to Programming Structure of C++ Program - Programming Terminologies - Microsoft Visual Studio.
Advertisements

History of.Net Introduced by Microsoft Earlier technology was VC++ and VB VC++ comes with so many library and VB was so easy to use and not flexible to.
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.
Chapter 3: Introducing the Microsoft.NET Framework and Visual Basic.NET Visual Basic.NET Programming: From Problem Analysis to Program Design.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
JavaScript, Third Edition
ASP.NET Programming with C# and SQL Server First Edition
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
Creating a Console Application with Visual Studio
Intro to dot Net Dr. John Abraham UTPA – Fall 09 CSCI 3327.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
An Introduction to C# and the .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.
Chapter Introduction to Computers and Programming 1.
Overview of Microsoft.Net and Vb.Net ITSE 2349 Spring 2002 Material from Microsoft.Net an Overview for ACC faculty by Stuart Laughton and Introduction.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
A First Program Using C#
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
© 2004 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Programming the Web Using ASP.Net Chapter 2: The ASP.Net Template Dave.
Introduction to .Net Framework
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.
C# A 1 CSC 298 Introduction to C#. C# A 2 What to expect in this class  Background: knowledge of an object oriented language of the C++, Java, … family.
Microsoft Visual Basic 2005: Reloaded Second Edition
Introduction to .NET Framework
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
Neal Stublen Class Objectives  Develop an understanding of the.NET Framework  Gain proficiency using Visual Studio  Begin learning.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 2 - Welcome Application: Introduction to C++
Introduction .NET Framework
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.
Computing with C# and the.NET Framework Chapter 1 An Introduction to Computing with C# ©2003, 2011 Art Gittleman.
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#
Week 1: THE C# LANGUAGE Chapter 1: Variables and Expressions ➤ Included in Visual Studio.NET ➤ What the.NET Framework is and what it contains ➤ How.NET.
 Simple C# program  Console applications input and output text in a console window, which in Windows XP and Windows Vista is known as the Command Prompt.
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.
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.
Rajiv and Shipra Introduction to.NET (asp.net,c#,vb)
tom perkins1 XML Web Services -.NET FRAMEWORK – Part 1 CHAPTER 1.1 – 1.3.
Module 1: Getting Started. Introduction to.NET and the.NET Framework Exploring Visual Studio.NET Creating a Windows Application Project Overview Use Visual.
Introduction to Visual Basic Programming. Introduction Simple Program: Printing a Line of Text Another Simple Program: Adding Integers Memory Concepts.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
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.
INTRODUCTION CHAPTER #1 Visual Basic.NET. VB.Net General features It is an object oriented language  In the past VB had objects but focus was not placed.
Module 1 Introducing C# and the.NET Framework. Module Overview Introduction to the.NET Framework 4 Creating Projects Within Visual Studio 2010 Writing.
Text Introduction to.NET Framework. CONFIDENTIAL Agenda .NET Training – Purpose  What is.NET?  Why.NET?  Advantages  Architecture  Components: CLR,
Session 02 Module 3: Statements and Operators Module 4: Programming constructs Module 5: Arrays.
Lecture Set 1 Part B: Understanding Visual Studio and.NET – Structure and Terminology 1/16/ :04 PM.
Chapter 3: Introducing the Microsoft.NET Framework and Visual Basic.NET Visual Basic.NET Programming: From Problem Analysis to Program Design.
Microsoft Visual Basic 2015 CHAPTER ONE Introduction to Visual Basic 2015 Programming.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 1 An Introduction to Visual Basic.NET and Program Design.
A Detailed Introduction To Visual Studio.NET CRB Tech ReviewsCRB Tech Reviews introduces you to the world of Visual.
IS 350 Course Introduction. Slide 2 Objectives Identify the steps performed in the software development life cycle Describe selected tools used to design.
C# Diline Giriş.
C# Programming: From Problem Analysis to Program Design
Introduction to Visual Basic 2008 Programming
C# and the .NET Framework
Module 1: Getting Started
CIS16 Application Development – Programming with Visual Basic
Chapter 3 – Introduction to C# Programming
.Net Framework Details Imran Rashid CTO at ManiWeber Technologies.
IS 135 Business Programming
Presentation transcript:

Module 1: Introduction to C# Module 2: Variables and Data Types Session 01 Module 1: Introduction to C# Module 2: Variables and Data Types

Introduction & Variables & Data types / Session 1 / 2 of 41 Module1 - Objectives Describe the .NET Framework List the other components of .NET Framework Explain CLR and MSIL Define Memory Management and Garbage Collection Describe the Microsoft Visual Studio 2005 product Learn the key elements of Visual Studio 2005 IDE List the basic features of C# Introduction & Variables & Data types / Session 1 / 2 of 41

Architecture of .Net Framework(1) The .Net Framework is a multi-lingual environment to build, deploy and run applications It enables programmers to develop applications for various platform such as mobile devices, desktop computer, smartphones and so on. Introduction & Variables & Data types / Session 1 / 3 of 41

Architecture of .Net Framework(2) The .Net Framework architecture comprises of following: Languages included in the .Net Framework .Net Framework class library (FCL) The Common Language Runtime(CLR) Introduction & Variables & Data types / Session 1 / 4 of 41

Architecture of .Net Framework(3) Other importance components in .Net Framework Web Forms Web services Windows Forms ASP.NET ADO.NET XML Classes Base Framework Classes Common Language Specification Common Type System Introduction & Variables & Data types / Session 1 / 5 of 41

Microsoft Intermediate Language(MSIL) When code written in .Net Framework language such as C#,VB…is complied, output code is in the form of Microsoft Intermediate Language(MSIL) Introduction & Variables & Data types / Session 1 / 6 of 41

Common Language Runtime(CLR) When a code is executed for first time, the MSIL code is converted to a code native to operating system. This is done ar runtime by the Just-in-Time(JIT) compiler present in CLR. Introduction & Variables & Data types / Session 1 / 7 of 41

Introduction & Variables & Data types / Session 1 / 8 of 41 Basic Features of C# Object-oriented programming language Type safety checking Garbage collection Standarbisation by ECMA(European Computer Manufacturers Association) Generic Types and Methods Introduction & Variables & Data types / Session 1 / 8 of 41

Introduction & Variables & Data types / Session 1 / 9 of 41 Visual Studio 2005(1) Visual studio 2005 is complete set of development tools to build desktop applications, web application, XML web service and mobile applications. Primary advantages are: Development of applications for .Net Framework 2.0 Development of applications for handheld devices using .Net Compact Framework 2.0 Introduction & Variables & Data types / Session 1 / 9 of 41

Introduction & Variables & Data types / Session 1 / 10 of 41 Visual Studio 2005(2) Introduction & Variables & Data types / Session 1 / 10 of 41

Introduction & Variables & Data types / Session 1 / 11 of 41 Key elements of VS 2005 Solution Explorer Code Editor Properties Window Dynamic help Introduction & Variables & Data types / Session 1 / 11 of 41

Write and run first console application Step 1: Create new project Introduction & Variables & Data types / Session 1 / 12 of 41

Write and run first console application Step 2:Compile program You can compile console application from command line or use IDE If compile program from command line: Edit PATH variable, add following line in PATH C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727; in command line window, change to directory of program and type: csc <fileName.cs> If use IDE, press F6 to compile program Introduction & Variables & Data types / Session 1 / 13 of 41

Write and run first console application Step 3: Run program If use command line window, type .exe file name If use IDE, press Ctrl + F5 Introduction & Variables & Data types / Session 1 / 14 of 41

Introduction & Variables & Data types / Session 1 / 15 of 41 Module 1 – Summary (1) .Net Framework is multi-language platform to build, deploy and run various types of applications Two major components of .Net Framework is CLR and FCL When code is written in .Net language such as C#,VB…compiled, output code is converted to code native to operating system by Just-In-Time language Introduction & Variables & Data types / Session 1 / 15 of 41

Introduction & Variables & Data types / Session 1 / 16 of 41 Module 1 – Summary (2) C# is an object-oriented programming language derived from c and C++. C# support features like type-safety checking, garbage collection, ECMA standardization, generics Visual studio 2005 is complete set of tool to build high performance applications Introduction & Variables & Data types / Session 1 / 16 of 41

Introduction & Variables & Data types / Session 1 / 17 of 41 Module 2 - Objectives Identify basic data types in C# Explain XML source code documentation List the keywords in C# Describe reference data types Constants and Literals Describe console output methods in C# Explain number and datetime format specifiers Introduction & Variables & Data types / Session 1 / 17 of 41

Introduction & Variables & Data types / Session 1 / 18 of 41 A variable is an entity whose value can keep changing Declaration syntax: <datatype> <variableName> [,variableName=<value>]; Assignment syntax: <variable> = <value>; Introduction & Variables & Data types / Session 1 / 18 of 41

Introduction & Variables & Data types / Session 1 / 19 of 41 In C#, data types are also divided into two categories: Value types: Can be either the built-in data type or a user-defined data type. Stack storage results in faster memory allocation to variables of value types Reference types: Variables of reference type store the memory address of other variables in a heap. Most of user-defined data types such as class are reference types. Introduction & Variables & Data types / Session 1 / 19 of 41

Introduction & Variables & Data types / Session 1 / 20 of 41

Predefined Data Types (1) The predefined data types are referred to as basic data types in C#. These data types have a predefined range and size. The size of the data type helps the compiler to allocate memory space and ensure the value assigned is within the range of the data type. Introduction & Variables & Data types / Session 1 / 21 of 41

Predefined Data Types (2) Introduction & Variables & Data types / Session 1 / 22 of 41

Reference Data Type Classification Reference types can be classified as Introduction & Variables & Data types / Session 1 / 23 of 41

Some Reference Data Types Introduction & Variables & Data types / Session 1 / 24 of 41

Introduction & Variables & Data types / Session 1 / 25 of 41 Variable Naming Rules Introduction & Variables & Data types / Session 1 / 25 of 41

Introduction & Variables & Data types / Session 1 / 26 of 41 Comments Comments are given by programmer to provide information about a piece of code. Comments make the program more readable. Comments help the programmer to explain the purpose of using a particular variable, method, class, or code snippet. Comments are ignored by the compiler during the execution of the program. C# supports three types of comments: Single-line comments Multiple-line comments XML comments Introduction & Variables & Data types / Session 1 / 26 of 41

Introduction & Variables & Data types / Session 1 / 27 of 41 XML Documentation In C#, we can create an XML document that will contain all the XML comments. This document is useful when multiple programmers want to view information of the program. To create an XML document, we must use the VS 2005 command prompt window. csc /doc:<XMLfilename.xml> <CSharpfilename.cs> Introduction & Variables & Data types / Session 1 / 27 of 41

Introduction & Variables & Data types / Session 1 / 28 of 41 Predefined XML Tags XML comments are inserted in XML tags. These tags can either be predefined or user-defined. XML comments begin with three forward slashes (///) Introduction & Variables & Data types / Session 1 / 28 of 41

Introduction & Variables & Data types / Session 1 / 29 of 41 Constants Constants are fixed values assigned to identifiers that are not modified throughout the execution of the code. We have to initialize a constant at the time of its declaration. The compiler can identify constants at the time of compilation because of the const keyword. Introduction & Variables & Data types / Session 1 / 29 of 41

Introduction & Variables & Data types / Session 1 / 30 of 41 Literals A literal is a static value assigned to variables and constants In C#, there are six types of literals Introduction & Variables & Data types / Session 1 / 30 of 41

Introduction & Variables & Data types / Session 1 / 31 of 41 Keywords Keywords are reserved words and are separately compiled by the compiler. They convey a predefined meaning to the compiler and hence cannot be created or modified. Introduction & Variables & Data types / Session 1 / 31 of 41

Escape sequence characters in C# Introduction & Variables & Data types / Session 1 / 32 of 41

Console Input/Output Operations Two output methods: Console.Write() and Console.WriteLine() These two methods accept parameters for formatting the text before the output is displayed Console.Write(“Customer name: {0}”, custName); Console.WriteLine(“Total amount: ${0:#,###.#0}”, totalAmount); Two input methods: Console.Read() and Console.ReadLine() custName = Console.ReadLine(); Introduction & Variables & Data types / Session 1 / 33 of 41

Introduction & Variables & Data types / Session 1 / 34 of 41 Convert Methods The ReadLine() method can also be used to accept integer values. The data is accepted as string and then converted into other data type by a Convert class age = Convert.ToInt32(Console.ReadLine()); Introduction & Variables & Data types / Session 1 / 34 of 41

Introduction & Variables & Data types / Session 1 / 35 of 41 Format Specifiers Format specifiers are special characters that are used to display values of variables in a formatted manner. Some type of format specifiers Number Format Specifiers Datetime Format Specifiers Introduction & Variables & Data types / Session 1 / 35 of 41

Number Format Specifiers We can convert numeric values in different formats. Introduction & Variables & Data types / Session 1 / 36 of 41

More Number Format Specifiers Introduction & Variables & Data types / Session 1 / 37 of 41

Datetime Format Specifiers Introduction & Variables & Data types / Session 1 / 38 of 41

More Datetime Format Specifiers Introduction & Variables & Data types / Session 1 / 39 of 41

Introduction & Variables & Data types / Session 1 / 40 of 41 Module 2 – Summary (1) In C#, data types are also divided into two categories: value types and reference types The predefined data types are referred to as basic data types in C#. C# supports three types of comments XML comments are inserted in XML tags. These tags can either be predefined or user-defined. Introduction & Variables & Data types / Session 1 / 40 of 41

Introduction & Variables & Data types / Session 1 / 41 of 41 Module 2 – Summary (2) Two output methods: Console.Write() and Console.WriteLine() Two input methods: Console.Read() and Console.ReadLine() Convert class is used to convert a variable into another data type. Some type of format specifiers: number and datatime Introduction & Variables & Data types / Session 1 / 41 of 41