CS360 Windows Programming

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 12 Introduction to ASP.NET.
Advertisements

pa 1 Porting BETA to ROTOR ROTOR Projects Presentation Day, June by Peter Andersen.
Language Fundamentals in brief C# - Introduction.
BY BOWYA G.  This International Standard is based on a submission from Hewlett-Packard, Intel, and Microsoft, that describes a language called C#. 
The Type System1. 2.NET Type System The type system is the part of the CLR that defines all the types that programmers can use, and allows developers.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Principles of Object-Oriented Software Development The language Java.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
Advanced Object-Oriented Programming Features
INSTRUCTOR: DR MARCO VALTORTA CSCE 330 C# GROUP MEMBERS: KONSTANTINOS MALEGOS YASSER AL-MUTAIRY CHRIS HESTER UNIVERSITY OF SOUTH CAROLINA.
C#/.NET Jacob Lewallen. C# vs.NET.NET is a platform. Many languages compile to.NET: –VB.NET –Python.NET –Managed C++ –C#
Java CourseWinter 2009/10. Introduction Object oriented, imperative programming language. Developed: Inspired by C++ programming language.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
From C++ to C#. Web programming The course is on web programming using ASP.Net and C# The course is on web programming using ASP.Net and C# ASP.Net is.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
OOP Languages: Java vs C++
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
Effective C# 50 Specific Way to Improve Your C# Item 50 Scott68.Chang.
Object Oriented Programming CEN 221. Course Description Classes, objects, inheritance, polymorphism, graphical user interfaces, event handling, exception.
Chapter 6—Objects and Classes The Art and Science of An Introduction to Computer Science ERIC S. ROBERTS Java Objects and Classes C H A P T E R 6 To beautify.
Programming Languages and Paradigms Object-Oriented Programming.
1 8/29/05CS360 Windows Programming Professor Shereen Khoja.
.NET Overview. 2 Objectives Introduce.NET –overview –languages –libraries –development and execution model Examine simple C# program.
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.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
BIM313 – Advanced Programming Techniques Object-Oriented Programming 1.
C# Programming Fundamentals of Object-Oriented Programming Fundamentals of Object-Oriented Programming Introducing Microsoft.NET Introducing Microsoft.NET.
Distributed Systems (236351) Tutorial 1 - Getting Started with Visual Studio C#.NET.
Object Oriented Programming: Java Edition By: Samuel Robinson.
Managed C++. Objectives Overview to Visual C++.NET Concepts and architecture Developing with Managed Extensions for C++ Use cases Managed C++, Visual.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
Session 08 Module 14: Generics and Iterator Module 15: Anonymous & partial class & Nullable type.
ILM Proprietary and Confidential -
C# EMILEE KING. HISTORY OF C# In the late 1990’s Microsoft recognized the need to be able to develop applications that can run on multiple operating system.
1 9/6/05CS360 Windows Programming CS360 Windows Programming.
Introduction to C# By: Abir Ghattas Michel Barakat.
The Execution System1. 2 Introduction Managed code and managed data qualify code or data that executes in cooperation with the execution engine The execution.
Session 02 Module 3: Statements and Operators Module 4: Programming constructs Module 5: Arrays.
Overview CNS 3260 C#.NET Software Development. 2.NET Framework Began in 2000 Developed in three years (2000 to 2003) Operating System Hardware.NET Framework.
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
Features of.net Language independent Object oriented program Multi threading Exception handling Drag and drop Linq
METADATA IN.NET Presented By Sukumar Manduva. INTRODUCTION  What is Metadata ? Metadata is a binary information which contains the complete description.
INTRODUCTION BEGINNING C#. C# AND THE.NET RUNTIME AND LIBRARIES The C# compiler compiles and convert C# programs. NET Common Language Runtime (CLR) executes.
C# Part 1 Intro to C#. Background Designed to be simple, modern, general- purpose, OO, programming language Strong type checking, array bounds checking,
Konstantinos pantos Software solutions architect Techaholics
Creating and Using Objects, Exceptions, Strings
Basic Introduction to C#
INF230 Basics in C# Programming
Static data members Constructors and Destructors
Abstract Data Types and Encapsulation Concepts
Advanced Object-Oriented Programming Features
2.7 Inheritance Types of inheritance
Module 5: Common Type System
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
Object-Orientated Programming
Array Array is a variable which holds multiple values (elements) of similar data types. All the values are having their own index with an array. Index.
CMPE419 Mobile Application Development
Introduction to C# AKEEL AHMED.
C# In many ways, C# looks similar to Java
.NET and .NET Core 5.2 Type Operations Pan Wuming 2016.
Programming in C# CHAPTER 1
Abstract Data Types and Encapsulation Concepts
Pointers C#, pointers can only be declared to hold the memory addresses of value types int i = 5; int *p; p = &i; *p = 10; // changes the value of i to.
5. 3 Coding with Denotations
Paul Stubbs MCSD, MCSE 4.0, MCP+I, MCT, MCAD .Net
CMPE419 Mobile Application Development
Presentation transcript:

CS360 Windows Programming 9/1/05 CS360 Windows Programming

CS360 Windows Programming .NET Framework Components of the .NET framework Framework Class Library (FCL) Common Language Runtime (CLR) Common Intermediate Language (CIL) 9/1/05 CS360 Windows Programming

CS360 Windows Programming Managed Modules An executable designed to be run by the CLR is a managed module One of the elements of the managed module is the metadata that describes the contents of the module 9/1/05 CS360 Windows Programming

CS360 Windows Programming ILDASM The metadata includes List of all types (i.e. classes) List of methods (functions) List of fields List of properties Visual Studio provides a tool that enables us to view the metadata ILDASM 9/1/05 CS360 Windows Programming

CS360 Windows Programming ILDASM using System; namespace ConsoleApplication1 { class Class1 [STAThread] static void Main(string[] args) Console.WriteLine( "Hello World!" ); } 9/1/05 CS360 Windows Programming

Common Intermediate Language CIL is a pseudo-assembly language Includes around 100 instructions Uses a stack-based execution model Loading copies from memory to the stack Storing copies from the stack to memory 9/1/05 CS360 Windows Programming

CS360 Windows Programming Example int a = 3; int b = 7; int c = a + b; ldc.i4.3  // Load a 32-bit (i4) 3 onto the stack stloc.0   // Store it in local variable 0 (a) ldc.i4.7  // Load a 32-bit (i4) 7 onto the stack stloc.1   // Store it in local variable 1 (b) ldloc.0   // Load local variable 0 onto the stack ldloc.1   // Load local variable 1 onto the stack add       // Add the two and leave the sum on the stack stloc.2   // Store the sum in local variable 2 (c) 9/1/05 CS360 Windows Programming

CS360 Windows Programming Example using System; namespace ConsoleApplication1 { class Class1 [STAThread] static void Main(string[] args) int x = 8; Console.WriteLine( "Hello World!" + x ); } 9/1/05 CS360 Windows Programming

Intellectual Property Issues Is it a problem that we can disassemble the programs from their executables? Web services are never exposed to users Code distributed to end users can be scrambled 9/1/05 CS360 Windows Programming

.NET Framework Class Library C Programmers Use Windows API C++ Programmers Use MFC Visual Basic Programmers Visual Basic API .NET Programmers .NET Framework Class Library 9/1/05 CS360 Windows Programming

CS360 Windows Programming OOP Abstraction Encapsulation Inheritance Polymorphism 9/1/05 CS360 Windows Programming

CS360 Windows Programming Why is C# Important? Designed specifically for writing .NET code Includes modern language features An improvement over existing languages 9/1/05 CS360 Windows Programming

CS360 Windows Programming C#: Design Goals A simple, modern, general-purpose, object-oriented language Support for software engineering principles such as type checking array bounds checking detection of use of uninitialized variables garbage collection multi-threading exception handling explicit pointers only in "unsafe" code 9/1/05 CS360 Windows Programming

C#: Design Goals (continued) Suitable for applications deployed in a distributed environment Familiar syntax for C/C++ programmers Economical in use of memory and processing requirements, but not competing directly with C or assembly language on size or performance 9/1/05 CS360 Windows Programming

C#: Language Constructs Operators and Expressions: same as C++ Arrays: 1-D, multi-D, jagged Flow Control: if/else switch goto continue break return Iteration for while do/while 9/1/05 CS360 Windows Programming

CS360 Windows Programming C#: Classes Single inheritance Can implement multiple interfaces Members Fields, methods (including constructors), properties, indexers, events Access control: public, protected, internal, private Static and instance members Abstract methods (for polymorphism) Nested types 9/1/05 CS360 Windows Programming

Let’s Do Something Practical using System; class Hello { static void Main() Console.WriteLine("Hello, world!"); } Type: types include classes, structs, enumerations, etc Method (Another name for function) 9/1/05 CS360 Windows Programming

CS360 Windows Programming Another Example Write the definition for a class Rational that stores the numerator and denominator The class should contain the necessary constructors The class should also have the following functions Add Operator+ ToString ReduceToLowestTerms Gcd 9/1/05 CS360 Windows Programming

CS360 Windows Programming Rational class Rational { private int num, den; public Rational(int numerator, int denominator) this.num = numerator; this.den = denominator; ReduceToLowestTerms(); } 9/1/05 CS360 Windows Programming

CS360 Windows Programming Rational public Rational(int num) : this(num, 1) { } public Rational() : this(0, 1) 9/1/05 CS360 Windows Programming

CS360 Windows Programming Rational public Rational Add(Rational r) { Rational sum = new Rational(r.num * this.den + r.den * this.num, r.den * this.den); return sum; } 9/1/05 CS360 Windows Programming

CS360 Windows Programming Rational public static Rational operator +(Rational r1, Rational r2) { return r1.Add(r2); } 9/1/05 CS360 Windows Programming

CS360 Windows Programming Rational public override string ToString() { return "[" + num + " / " + den + "]"; } private void ReduceToLowestTerms() int g = Gcd(num, den); num /= g; den /= g; private int Gcd(int x, int y) if (y == 0) return x; else return Gcd(y, x % y); 9/1/05 CS360 Windows Programming

CS360 Windows Programming Rational All the previous create the Rational class How can we test the Rational class? 9/1/05 CS360 Windows Programming

CS360 Windows Programming Summary We have completed chapter 1 P. 3 - 26 9/1/05 CS360 Windows Programming