Introduction to.net, C#, and Visual Studio. Part I. Administrivia. Administrivia. Course Structure. Final Project. Part II. What is.net?

Similar documents
Introduce C# as Object Oriented programming language. Explain, tokens,

Introduction to.net Framework

Introduction to.net Framework Week 1. Tahir Nawaz

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations

.Net Technologies. Components of.net Framework

NOIDATUT E Leaning Platform

Question No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given

Chapter 1 Getting Started

EEE-425 Programming Languages (2013) 1

IT 528 Developing.NET Applications Using C# Gülşen Demiröz

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

Darshan Institute of Engineering & Technology for Diploma Studies

Creating and Running Your First C# Program

EEE-425 Programming Languages (2013) 1

C#: framework overview and in-the-small features

PES INSTITUTE OF TECHNOLOGY

UNIT I An overview of Programming models Programmers Perspective

C# Programming in the.net Framework

This tutorial has been prepared for the beginners to help them understand basics of c# Programming.

10/9/2012. Sample C# program:

Discovering Computers 2008

This web service can be available to any user on the internet regardless of who developed it.

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

SWE344. Internet Protocols and Client-Server Programming

New programming language introduced by Microsoft contained in its.net technology Uses many of the best features of C++, Java, Visual Basic, and other

Getting started 7. Storing values 21. Creating variables 22 Reading input 24 Employing arrays 26 Casting data types 28 Fixing constants 30 Summary 32

10266 Programming in C Sharp with Microsoft Visual Studio 2010

Programming in C# with Microsoft Visual Studio 2010

C# Java. C# Types Naming Conventions. Distribution and Integration Technologies. C# C++.NET A C# program is a collection of: C C++ C# Language

Distribution and Integration Technologies. C# Language

A NET Refresher

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain

2. A GUI A. uses buttons, menus, and icons B. should be easy for a user to manipulate C. both (a) and (b) D. stands for Graphic Use Interaction

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class.

Introducing C# and the.net Framework

Microsoft..NET Framework. Overview

"Charting the Course... MOC Programming in C# with Microsoft Visual Studio Course Summary

Discovering Computers Chapter 13 Programming Languages and Program Development

Programming in Visual Basic with Microsoft Visual Studio 2010

Chapter 1:- Introduction to.net. Compiled By:- Ankit Shah Assistant Professor, SVBIT.

PROGRAMMING IN VISUAL BASIC WITH MICROSOFT VISUAL STUDIO Course: 10550A; Duration: 5 Days; Instructor-led

Unit 1: Visual Basic.NET and the.net Framework

C++\CLI. Jim Fawcett CSE687-OnLine Object Oriented Design Summer 2017

Microsoft Visual Basic 2005: Reloaded

DAD Lab. 1 Introduc7on to C#

3. Basic Concepts. 3.1 Application Startup

Welcome to Introduction to Computer Science I

Lecture 09. Ada to Software Engineering. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

HCIM SUMMER WORKSHOP Introduction to C#

Chapter 12 Microsoft Assemblies. Software Architecture Microsoft Assemblies 1

CSC 326H1F, Fall Programming Languages. What languages do you know? Instructor: Ali Juma. A survey of counted loops: FORTRAN

MCSA Universal Windows Platform. A Success Guide to Prepare- Programming in C# edusum.com

VISUAL PROGRAMMING_IT0309 Semester Number 05. G.Sujatha & R.Vijayalakshmi Assistant professor(o.g) SRM University, Kattankulathur

UEE1302 (1102) F10: Introduction to Computers and Programming

Chapter 1. Preliminaries

Programming in C# for Experienced Programmers

DOT NET Syllabus (6 Months)

Question And Answer.

Top 40.NET Interview Questions & Answers

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING

1) What is the first step of the system development life cycle (SDLC)? A) Design B) Analysis C) Problem and Opportunity Identification D) Development

Developing Microsoft.NET Applications for Windows (Visual Basic.NET)

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

Principles in Programming: Orientation & Lecture 1. SWE2004: Principles in Programming Spring 2014 Euiseong Seo

Course Hours

20483BC: Programming in C#

The C# Programming Language. Overview

.Net Interview Questions

Appendix G: Writing Managed C++ Code for the.net Framework

Saikat Banerjee Page 1

Introduction to Programming Using Java (98-388)

Languages october 22, 2017 Éric Lévénez < FORTRAN III end-1958 FORTRAN II FORTRAN I october 1956

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline

A Comparison of Visual Basic.NET and C#

Program Contents: DOTNET TRAINING IN CHENNAI

Prof. Dr. Hanspeter Mössenböck Institute for System Software Johannes Kepler University Linz

Visual Studio.NET.NET Framework. Web Services Web Forms Windows Forms. Data and XML classes. Framework Base Classes. Common Language Runtime

Object-Oriented Programming in C# (VS 2015)

CSc 520. Course Outline (Subject to change) Course Outline (Subject to change)... Principles of Programming Languages. Christian Collberg

.NET-6Weeks Project Based Training

Chapter 5. Names, Bindings, and Scopes

Introduction To C#.NET

Introduction to.net. What is.net?

Programming in C# (20483)

C# Syllabus. MS.NET Framework Introduction

Chapter 1 Preliminaries

Introduction to Computer Science I

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio

UNIT 1. Introduction to Microsoft.NET framework and Basics of VB.Net

Low-Level Languages. Computer Programs and Programming Languages

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments

Module 6: Fundamentals of Object- Oriented Programming

Why are there so many programming languages? Why do we have programming languages? What is a language for? What makes a language successful?

Department of Computer Applications

II. Programming Technologies

Fig 1.1.NET Framework Architecture Block Diagram

CS252 Advanced Programming Language Principles. Prof. Tom Austin San José State University Fall 2013


Assumptions. History

Chapter 1: A First Program Using C#

Transcription:

Introduction to.net, C#, and Visual Studio C# Programming Part I Administrivia January 8 Administrivia Course Structure When: Wednesdays 10 11am (and a few Mondays as needed) Where: Moore 100B This lab has Windows machines, but feel free to bring laptops Office Hours: to be announced Course webpage: http://www.seas.upenn.edu/~cse39905 No quizzes, no exams Roughly 6 projects Roughly 2 weeks per project The final project will be slightly longer and more open-ended Projects will be due at midnight on the night of the deadline All assignments should be submitted through the Blackboard Digital Dropbox Late policy: 15% off each day, up to 3 days late Final Project Your chance to choose your own project Brainstorming and planning will begin after spring break Top projects will be entered into the Xtreme.NET Challenge hopefully there will be 20 top projects :-) First prize: Xbox 360! Judges will include someone from Microsoft recruiting, maybe someonefromthec#team More details to come at http://www.seas.upenn.edu/~cse39905/xtreme Part II What is.net?

The Microsoft.NET Framework Common Language Runtime.NET is a development platform that launched in 2000 Goals include language independence, language integration, web services Technologies to promote rapid development of secure, connected applications.net components include: Languages (C#, VB, Visual C++, Visual J#, ) Common Language Runtime (CLR) Framework Class Library (FCL) A single runtime environment to execute programs written in any.net language Includes a virtual machine Activates objects, manages memory, performs security checks, collects garbage TorunontheCLR,alanguagemustadheretoaCommon Language Specification (CLS) A language must also build upon base types specified in the Common Type System (CTS) Languages Languages Language compilers translatesourceinto Microsoft Intermediate Language (MSIL). The particular syntax of a language is unrestricted. (Language independence) Since each language targets the same IL with thesamebasetype system, objects written in any.net language can extend, implement, and interact with any other.net objects. (Language integration) List of.net Languages (http://www.dotnetpowered.com/languages.aspx) Ada APL AsmL Basic BETA BF Boo C C# C++ Caml CAT Cobol CULE E# Eiffel F# Flash Forth Fortran G# Haskell IL/MSIL Java JavaScript Lexico LISP LOGO Lua Mercury Modula Mondrian Oberon Nemerle Pan Perl Pascal PHP Processing Prolog Python Ruby RPG Scala Scheme Smalltalk SML Spry Synergy Tcl/Tk Zonnon Common Language Runtime The result of compilation ie, MSIL is not machine code At runtime, this intermediate code is Just In Time (JIT) compiled into machine instructions to execute Methods are JITed as they are needed, and cached for future use JITing allows optimizations based on the environment of the running program

Framework Class Library Bottom layer contains classes that support: input and output string manipulation security management network communication thread management text manipulation reflection collections functionality etc. Next layer contains classes that support management of SQL and XML data Top layer supports application development Windows Forms Web Forms Web Services Benefits of.net From the ground up The CLR abstracts away low-level details of the processor architecture and of Windows system calls It also manages memory automatically The FCL provides a rich collection of classes to build upon, including convenient ways of connecting to remote data stores The Windows Forms, Web Forms, and Web Service libraries facilitate rapid development of rich interface applications, both desktop and web Applications written in any.net language can interoperate with each other Language Features Part III What is C#? C# is the.net language of choice for serious development (VB.NET is also very expressive, but gets a bad rap) A modern object-oriented language with its roots in C, C++, and Java C# 2.0 (and.net 2.0) released in November 2005 New features included generics and anonymous methods C# 3.0 (and.net 3.0) planned for 2007 New language features will include anonymous types, lambda expressions, and Language Integrated Query (LINQ) Language Features Built-in value types (byte, char, bool, int, float, double, decimal, long, struct, enum, etc.) Classes, partial class definitions Single inheritance Interfaces Structs Delegates ( type-safe function pointers ) Properties (in place of getters and setters) Operator overloading Preprocessor directives Unsafe manipulation of pointers directly Commenting that generates documentation Part IV Hello World

Visual Studio Creating a Console App Before we can write the simplest of programs, we need to become familiar with the Visual Studio development environment. Visual Studio facilitates rapid development with its Form Designer This allows the programmer to literally drag-and-drop GUI elements onto their window (or form) Double-clicking a form element creates a function (or event handler) that responds to that control s particular events Visual Studio s Form Designer has long been around for Visual Basic development It now offers this rich GUI development environment to all.net languages More on this next time Creating a Console App Project Organization A solution is a collection of projects Projects can be added and removed from a solution freely you can organize a solution to contain related projects for simplicity To prevent naming conflicts, the namespace keyword restricts when classes are in scope YoucanthinkofanamespaceasaJavapackage To refer to a class Foo in namespace Moo, you would write Moo.Foo If you write using Moo; outside of the namespace and class declarations, you can use Foo without qualification If you choose to create a directory for solution, then all projects that are created within the solution will reside in the same folder Hello World Compiling and Running using System; namespace HelloWorld class Hello static void Main(string[] args) Console.WriteLine("Hello world!"); To build the entire solution, F6 To build the current project, Shift + F6 To run the main project without debugging, Shift + F5 To run the main project with debugging, F5

Compiling and Running To build the entire solution, F6 To build the current project, Shift + F6 To run the main project without debugging, Shift + F5 To run the main project with debugging, F5 Part V Some Language Features Types The following keywords, representing built-in C# types, are aliases for corresponding.net types. bool System.Boolean uint System.UInt32 byte System.Byte long System.Int64 sbyte System.SByte ulong System.UInt64 char System.Char object System.Object decimal System.Decimal short System.Int16 double System.Double ushort System.UInt16 float System.Single string System.String int System.Int32 These keywords and.net types (actually defined as structs) are interchangeable. Access Modifiers Each instance variable and method of a class has a visibility level. public Accessible anywhere private Accessible only within the class protected Accessible within the class and within its descendants internal Accessible within the class and within all classes in the same assembly protected internal Accessible within the class, within its descendants, and within all classes in the same assembly The default visibility (if none is explicitly written), is internal. Properties In good style, instance variable are declared private In the event that these need to be read or modified from the outside, getter and/or setter methods need to be defined Properties in C# achieve this behavior without sacrificing the encapsulation of instance variables and without the the untidiness of getters and setters everywhere Setting the Console s Title The Console class,whichweusedinourfirstexample,isaclass defined somewhere in System namespace. We imagine that is has some string instance variable that holds the value of the window s title. Part of the class might look like: public class Console private static string title; public static void gettitle() return this.title; public static void settitle(string title) this.title = title;

Setting the Console s Title Defining a property instead of a getter and setter, the class might look like: public class Console private static string title; public static string Title get return title; set title = value; Setting the Console s Title Now from the outside, the window s title can be changed by Console.Title = "C# Saves the Day!"; Either the get or the set definition can be omitted as needed By convention, properties begin with a capital letter (and instance variables with a lowercase letter) Comments // Single line comment /* Multi-line comments can span multiple lines */ /// <summary> /// These comments construct XML documentation /// for the code. /// All comments within these tags get extracted /// when the documentation generator is run. /// These also appear in the IntelliSense. /// </summary>