Creating and Running Your First C# Program

Similar documents
EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1

10/9/2012. Sample C# program:

DE Introduction to Web Development with Microsoft Visual Studio 2010

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

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

..to the Berlin BAU Software Lab! Let's have two interesting weeks together! (c)schmiedecke C# and.net

Introduction to Web Development with Microsoft Visual Studio 2010 (10267A)

Course Outline: Course 10267A: Introduction to Web Development with Microsoft Visual Studio 2010 Learning Method: Instructor-led Classroom Learning

Programming in Visual Basic with Microsoft Visual Studio 2010

Introduction to Web Development with Microsoft Visual Studio 2010

Chapter 1 Getting Started

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

CSE 142. Lecture 1 Course Introduction; Basic Java. Portions Copyright 2008 by Pearson Education

2310C VB - Developing Web Applications Using Microsoft Visual Studio 2008 Course Number: 2310C Course Length: 5 Days

.Net. Course Content ASP.NET

A NET Refresher

Announcements. 1. Forms to return today after class:

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

10267 Introduction to Web Development with Microsoft Visual Studio 2010

Apex TG India Pvt. Ltd.

DEVELOPING WEB APPLICATIONS WITH MICROSOFT VISUAL STUDIO Course: 10264A; Duration: 5 Days; Instructor-led

DE-2310 Developing Web Applications Using Microsoft Visual Studio 2008 SP1

Level: M.Ed. Credit Hour: 3 (2+1) Semester: Third Teaching Hour: 80(32+48)

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

DIPLOMA IN PROGRAMMING WITH DOT NET TECHNOLOGIES

COURSE OUTLINE: OD10267A Introduction to Web Development with Microsoft Visual Studio 2010

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

Introduction to Web Development with Microsoft Visual Studio 2010

Dot Net Online Training

10264A CS: Developing Web Applications with Microsoft Visual Studio 2010

10267A CS: Developing Web Applications Using Microsoft Visual Studio 2010

Learn to develop.net applications and master related technologies.

CS313T ADVANCED PROGRAMMING LANGUAGE

Overview of the Microsoft.NET Framework

DOT NET Syllabus (6 Months)

Developing Web Applications Using Microsoft Visual Studio 2008 SP1

Team Developer. There are no good reasons to stay in legacy mode.

DOT NET SYLLABUS FOR 6 MONTHS

Introduction to.net Framework

"Charting the Course... MOC A Introduction to Web Development with Microsoft Visual Studio Course Summary

ASP.NET Web Forms Programming Using Visual Basic.NET

Fundamental C# Programming

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

Object-Oriented Programming CSCI-UA

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

Microsoft Visual Studio 2010 Training Course Catalogue. Learning Solutions

Microsoft.NET Programming (C#, ASP.NET,ADO.NET, VB.NET, Crystal Report, Sql Server) Goal: Make the learner proficient in the usage of MS Technologies

(0) introduction to the course. how to learn a programming language. (0) course structure

PESIT- Bangalore South Campus Hosur Road (1km Before Electronic city) Bangalore

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

Programming in C# with Microsoft Visual Studio 2010

In this course, you need to use Pearson etext. Go to "Pearson etext and Video Notes".

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

San Jose State University - Department of Computer Science

Microsoft Official Courseware Course Introduction to Web Development with Microsoft Visual Studio

Developing Data Access Solutions with Microsoft Visual Studio 2010

In this course, you need to use Pearson etext. Go to "Pearson etext and Video Notes".

Mastering VB.NET using Visual Studio 2010 Course Length: 5 days Price: $2,500

The C# Programming Language. Overview

Vb Net Tutorial For Beginners Visual Studio 2010 Express Windows Service Template

CSCI 6312 Advanced Internet Programming

CMSC 132: Object-Oriented Programming II. Administrivia

Course Hours

Programming in C# for Experienced Programmers

San José State University Department of Computer Science CS151, Section 04 Object Oriented Design Spring 2018

You must pass the final exam to pass the course.

CSc 2310 Principles of Programming (Java) Jyoti Islam

CS 3270 Mobile Development for Android Syllabus

"Charting the Course... MOC A Developing Data Access Solutions with Microsoft Visual Studio Course Summary

COPYRIGHTED MATERIAL PART I. CHAPTER 1: Introducing C# CHAPTER 2: Writing a C# Program. CHAPTER 3: Variables and Expressions. CHAPTER 4: Flow Control

Chapter 12 Microsoft Assemblies. Software Architecture Microsoft Assemblies 1

San Jose State University College of Science Department of Computer Science CS151, Object-Oriented Design, Sections 1, 2, and 3, Spring 2018

CS 3813/718 Fall Python Programming. Professor Liang Huang.

Migrate Your Skills to Microsoft.NET Framework 2.0 and 3.0 using Visual Studio 2005 (C#)

Module 1. An Introduction to C# Module 2. Classes and Objects. Vasundhara Sector 14-A, Plot No , Near Vaishali Metro Station,Ghaziabad

Introducing C# and the.net Framework

MEAP Edition Manning Early Access Program Get Programming with Java Version 1

What s new in ASP.NET 3.5? Mike Ormond Developer & Platform Group Microsoft Ltd

Top 40.NET Interview Questions & Answers

INFORMATICS LABORATORY WORK #2

Course and Contact Information. Course Description. Course Objectives

HCI-4/631 Software Architectures for User Interfaces, Fall 2006

WA2 PRACTICE A. Windows Azure Platform Introduction

San José State University Computer Science Department CS49J, Section 3, Programming in Java, Fall 2015

Advanced WCF 4.0 .NET. Web Services. Contents for.net Professionals. Learn new and stay updated. Design Patterns, OOPS Principles, WCF, WPF, MVC &LINQ

.NET Advance Package Syllabus

COMP-202: Foundations of Programming. Lecture 26: Review; Wrap-Up Jackie Cheung, Winter 2016

Implementation on Curriculum Management System based on.net Li Ma

10265: Developing Data Access Solutions with Microsoft Visual Studio 2010 Duration: 5 Days Method: Instructor-Led

CS 210 Algorithms and Data Structures College of Information Technology and Engineering Weisberg Division of Engineering and Computer Science

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Building Rich Interactive Applications with Silverlight

Web Platform Introduction With a focus on free. Mike Taulty Developer & Platform Group Microsoft Ltd

Engr 123 Spring 2018 Notes on Visual Studio

Yoon Joong Kim. Department of computer Engineering Hanbat National University

The C# Language PART I. CHAPTER 1: Introducing C# CHAPTER 2: Writing a C# Program. CHAPTER 3: Variables and Expressions. CHAPTER 4: Flow Control

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

Skill Area 336 Explain Essential Programming Concept. Programming Language 2 (PL2)

COPYRIGHTED MATERIAL. Part I The C# Ecosystem. ChapTEr 1: The C# Environment. ChapTEr 2: Writing a First Program

Transcription:

Creating and Running Your First C# Program

: http://eembdersler.wordpress.com Choose the EEE-425Programming Languages (Fall) Textbook reading schedule Pdf lecture notes Updated class syllabus Midterm and final exams grades Answers of Midterm and Final Exam 2

Texts and Other Course Materials Programming C#, 4th Edition - Jesse Liberty (You may down this version the book from Internet - It is your responsibility to download it or buy the book from http://www.amazon.com/programming-c-jesse- Liberty/dp/B00006AVR5) Beginning.C.Sharp.3.0.An.Introduction Internet Materials Grading : Assignments 20% Midterm 15% Final : 25% Project : 40% ( Presentation, code and short report) Bonus : 10% ( If you follow all course no exception, you will get extra 10% of your grade) Total 110% 3

This course contains material that demands intense mental work and an unusual amount of time commitment. Student dedication is advised. 4

Instructor s expectations: Homework. Read chapters prior to class from the textbook Expect 2-4 hours outside classroom activities; Reading Participate. Ask questions. Contribute. Actively participate in the exercises. Consider the classroom to be a mental gymnasium where it s ok to run, fall, and get up again Take notes. Why let any idea get away? Taking notes will help you concentrate and organize your thoughts Notes allow you to take a refresher any time in the future. Enjoy yourself. Start relaxed and you ll leave refreshed, inspired, and recharged Forget about what s happening at home or at work This is your time. Get all you can out of this course and have a good time Excessive Late assignments: 10% penalty from the grade assigned for each day ( maximum 2 days) 5

Refer to the syllabus for details regarding Academic dishonesty NOCHEATHING is allowed for all materials. Given and taken person will be punished with less notes( 0) Attendance : 70% of Lectures Special attention for the class 6

Covers (most of) the C# language and some of the most useful.net API s. Should not be your first programming class. Assume you know C++ and basic object-oriented programming. Requires (lots of) practice / reading. C# and.net cannot be learned thoroughly in this brief course. 7

Require do all assignments Assignments are You will not be given a detailed grade Show me that you understand the concepts, and can write C# code Do a project that related with technical EEE by using C# ( It is important to apply your knowledge to one problem) Note : Pls dont just directly copy the code from Internet or somewhere as your project- If we know that is copied somewhere we will penalty its grade as 0 (zero) 8

Missing class sessions Failure to do homework Poor sleeping, drinking, eating, and physical exercise habits Failure to follow textbook Failure to prioritize and budget time for study, work, and social activities Copying other people s homework, quiz, or exam (Read Academic Integrity ) 9

To do well in this class, you have to work really hard. You need to be prepared to dedicate a significant amount of time and mental effort on this class. 10

can determine your grade in this class can make the choice to be successful can choose how you use your time can do the work of learning 11

1. What is Computer Programming? 2. Your First C# Program 3. What is.net Framework? 4. What is Visual Studio? 5. What is MSDN Library? 12

13

Computer programming: creating a sequence of instructions to enable the computer to do something Definition by Google 14

Define a task/problem Plan your solution Find suitable algorithm to solve it Find suitable data structures to use = Specification = Design Write code Fix program error (bugs) Make your customer happy = Implementation =Testing & Debugging = Deployment 15

Wikipedia.org definition. Object-oriented. Primarily imperative or procedural. LINQ (Language Integrated Query) adds some functional programming language capabilities. Structured (as opposed to monolithic). Strongly typed. ISO(International Organization for Standardization) and ECMA(European Computer Manufacturers Association) standardized. 16

17

Sample C# program: using System; namespace ConsoleApplication; class HelloCSharp { static void Main(string[] args) { Console.WriteLine("Hello, C#"); } } 18

Include the standard namespace "System" Define a class called "HelloCSharp" using System; class HelloCSharp { static void Main() { Console.WriteLine("Hello, C#"); } } Define the Main() method the program entry point Print a text on the console by calling the method "WriteLine" of the class "Console" 19

Class names should use HelloCsharp and start with a CAPITAL letter. using System; class HelloCSharp { static void Main() { Console.WriteLine("Hello, C#"); } } The } symbol should be under the corresponding {. The { symbol should be alone on a new line. The block after the { symbol should be indented by a TAB. 20

Such formatting makes the source code unreadable. System using ; class HelloCSharp { static void Main( ) { Console. WriteLine ("Hello, C#" ) ;Console. WriteLine ( "Hello again" ) ;}} 21

using like import in Java: bring in namespaces namespace disambiguation of names like Internet hierarchical names and C++ naming class like in C++ or Java single inheritance up to object

static void Main() Defines the entry point for an assembly. Four different overloads taking string arguments and returning int s. Console.WriteLine(Write) Takes a formatted string: Composite Format Indexed elements: e.g., {0} can be used multiple times only evaluated once {index [,alignment][:formatting]}

Programming language A syntax that allow to give instructions to the computer C# features: New cutting edge language Extremely powerful Easy to learn Easy to read and understand Object-oriented 24

Live Demo-Example 01-01, 01-02 25

26

Environment for execution of.net programs Powerful library of classes Programming model Common execution engine for many programming languages C# Visual Basic.NET Managed C++... and many others 27

Building blocks of.net Framework C# C++ VB.NET J# F# JScript Perl Delphi ASP.NET Web Forms, MVC, AJAX Mobile Internet Toolkit Windows Forms WPF Silverlight WCF and WWF (Communication and Workflow Tier) FCL ADO.NET, LINQ and XML (Data Tier) Base Class Library (BCL) Common Language Runtime (CLR) CLR Operating System (OS) 29

The common classes that are used in many programs System.Console.WriteLine XML, Networking, Filesystem, Crypto, containers Can inherit from many of these classes Many languages run on.net framework C#, C++, J#, Visual Basic even have Python (see IronPython)

Common Language Runtime (CLR) Managed execution environment Executes.NET applications Controls the execution process Automatic memory management (garbage collection) Programming languages integration Multiple versions support for assemblies Integrated type safety and security CLR 32

Base Class Library Support Thread Support Type Checker Security Engine COM Marshaler Exception Manager Debug Engine MSIL to Native Compilers (JIT) Code Manager Class Loader From MSDN Garbage Collector (GC)

CLR via C#, Jeffrey Richter

CLR is actually an implementation by Microsoft of the CLI (Common Language Infrastructure). CLI is an open specification. CLR is really a platform specific implementation. 35

Framework Class Library (FCL) Provides basic functionality to developers: Console applications WPF(Windows Presentation Framework) and Silverlight rich-media applications Windows Forms GUI applications Web applications (dynamic Web sites) Web services, communication and workflow Server & desktop applications Applications for mobile devices 36

37

38

Visual Studio Integrated Development Environment (IDE) Development tool that helps us to: Write code Design user interface Compile code Execute / test / debug applications Browse the help Manage project's files 39

Single tool for: Writing code in many languages (C#, VB, ) Using different technologies (Web, WPF, ) For different platforms (.NET CF, Silverlight, ) Full integration of most development activities (coding, compiling, testing, debugging, deployment, version control,...) Very easy to use! 40

41

Compiling, Running and Debugging C# Programs 42

1. File New Project... 2. Choose C# console application 3. Choose project directory and name 43

4. Visual Studio creates some source code for you Namespace not required Some imports are not required Class name should be changed 44

The process of compiling includes: Syntactic checks Type safety checks Translation of the source code to lower level language (MSIL) Creating of executable files (assemblies) You can start compilation by Using Build->Build Solution/Project Pressing [F6] or [Shift+Ctrl+B] 45

The process of running application includes: Compiling (if project not compiled) Starting the application You can run application by: Using Debug->Start menu By pressing [F5] or [Ctrl+F5] * NOTE: Not all types of projects are able to be started! 46

The process of debugging application includes: Spotting an error Finding the lines of code that cause the error Fixing the code Testing to check if the error is gone and no errors are introduced Iterative and continuous process 47

Visual Studio has built-in debugger It provides: Breakpoints Ability to trace the code execution Ability to inspect variables at runtime 48

49

Complete documentation of all classes and their functionality With descriptions of all methods, properties, events, etc. With code examples Related articles Library of samples Use local copy or the Web version at http://msdn.microsoft.com/ 50

Questions? 51

1. Create, compile and run a Hello C# console application. 2. Modify the application to print your name. 3. Write a program to print the numbers 1, 101 and 1001. 4. Create console application that prints your first and last name. 52

6. Create a console application that prints the current date and time. 7. Create a console application that calculates and prints the square of the number 12345. 8. Write a program that prints the first 10 members of the sequence: 2, -3, 4, -5, 6, - 7,... 9. Write a program to read your age from the console and print how old you will be after 10 years. 53