MIS Professor Sandvig MIS 324 Professor Sandvig

Slides:



Advertisements
Similar presentations
C# Console Application
Advertisements

Introduction to the C# Programming Language for the VB Programmer.
PHP Intro/Overview Squirrel Book pages Server-side Scripting Everything you need to know in one slide 1.Web server (with PHP “plug-in”) gets a.
An Introduction to C Programming Geb Thomas. Learning Objectives Learn how to write and compile a C program Learn what C libraries are Understand the.
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.
Object-Oriented Programming in C++
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015 C Tutorial CIS5027.
VB and C# Programming Basics. Overview Basic operations String processing Date processing Control structures Functions and subroutines.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
EIW - ASP Introduction1 Active Server Pages VBScript.
ALBERT WAVERING BOBBY SENG. Week 4: JavaScript  Quiz  Announcements/questions.
CMP-MX21: Lecture 4 Selections Steve Hordley. Overview 1. The if-else selection in JAVA 2. More useful JAVA operators 4. Other selection constructs in.
Loops (cont.). Loop Statements  while statement  do statement  for statement while ( condition ) statement; do { statement list; } while ( condition.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Session 02 Module 3: Statements and Operators Module 4: Programming constructs Module 5: Arrays.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Variable Scope MacDonald Ch. 2-3 MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
Chapter 9 Introduction to Arrays Fundamentals of Java.
Welcome to Computer Programming II! Computer Programming II Summer 2015.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
Chapter 5 Names, Bindings, Type Checking CSCE 343.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
PHP using MySQL Database for Web Development (part II)
Expressions and Control Flow in PHP
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Python Review 1.
Basic Introduction to C#
Intro to ETEC Java.
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
MIS Professor Sandvig MIS 324 Professor Sandvig
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Complex data types Complex data types: a data type made of a complex of smaller pieces. Pascal has four very commonly used complex data types: strings,
Java for Android is specific
JavaScript Syntax and Semantics
PHP Introduction.
Engineering Innovation Center
Chapter 3: Understanding C# Language Fundamentals
Arrays, Collections and Repetition Part A – Arrays and Repetition
MIS Professor Sandvig MIS 324 Professor Sandvig
I Know What I Want to Do – Now What??
Expressions and Assignment Statements
Arrays, For loop While loop Do while loop
Chapter 10 Programming Fundamentals with JavaScript
Data Types and Expressions
Overview of Memory Layout in C++
PHP Intro/Overview Bird Book pages 1-11,
Module 2: Understanding C# Language Fundamentals
Java Programming Arrays
PHP.
Class07 PHP: loops MIS 3501 Jeremy Shafer Department of MIS
Variables Title slide variables.
Sridhar Narayan Java Basics Sridhar Narayan
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
MIS Professor Sandvig MIS 324 Professor Sandvig
Data Types and Expressions
JavaScript CS 4640 Programming Languages for Web Applications
Java’s Central Casting
PHP an introduction.
design OO words Debug Variables Data types
Introduction to PHP.
Expressions and Assignment Statements
Data Types and Expressions
Lecture 9: JavaScript Syntax
IS 135 Business Programming
Intro to Programming (in JavaScript)
JavaScript CS 4640 Programming Languages for Web Applications
Data Types and Expressions
Presentation transcript:

MIS 324 -- Professor Sandvig MIS 324 Professor Sandvig 11/7/2018 C# Language MIS 324 Professor Sandvig

MIS 324 -- Professor Sandvig 11/7/2018 Overview Why learn C#? C# Basics Variables Data types Operators Control Structures

Why Learn C#? Modern language More user-friendly than older languages Microsoft introduced in 2000 More user-friendly than older languages Managed code Memory allocation Garbage collection 100% object oriented Widely used

MIS 324 -- Professor Sandvig 11/7/2018 Variables C# strongly typed Similar to VB.NET PHP loosely typed Strongly typed: A variable accepts only one data type Type is explicitly declared when variable is declared

MIS 324 -- Professor Sandvig 11/7/2018 Variables Strongly Typed Advantage Less error prone Compiler more likely to catch programming errors Disadvantage More explicit data type conversions

Variables Variables are objects Have properties & methods FName = FName.Replace(“S”,”P”);

MIS 324 -- Professor Sandvig 11/7/2018 Variables Commonly Used C# Data Types int 123 string “hi” double 1.23 bool true DateTime Jan. 8, 2010 1:23:46 pm

Datatype Conversion Implicit Conversion Done when no data lost

Datatype Conversion Web Forms .NET MVC Lots of data type conversions All data from web forms type string .NET MVC Data types defined in model Few datatype conversions needed

Variable Scope Control structures limit variable scope Where variable is visible Visible in structure and children

Variable Scope Try to minimize scope Minimize complexity “The road to Hell is paved with global variables” Steve McConnell Code Complete 2nd Ed.

Variable Scope Write code to minimize variable scope Good: Control structures Classes Good:

MIS 324 -- Professor Sandvig 11/7/2018 Common C# Operators Operator Function Example = Assignment int a = 3; == equality if (a == 3) >= Greater or equal if (a >= 3) + Add int c = 3 + 4; Concatenate string s = “Hello ”+ “world”; ++ Increment by 1 i++; += Sum i += 3; s += “ and other planets”; ! Negate if(a != b) Control Structures example

MIS 324 -- Professor Sandvig 11/7/2018 Control Structures Syntax similar to C, JavaScript, PHP, Java, … Curley brackets for statement blocks if (condition) { //Statement block } else //statement block

MIS 324 -- Professor Sandvig 11/7/2018 Control Structures May omit brackets for single statements: if (condition) statement 1; else statement 2;

MIS 324 -- Professor Sandvig 11/7/2018 Control Structures Similar in all languages Syntax may be different if for foreach while

MIS 324 -- Professor Sandvig 11/7/2018 Control Structures 1. if else: if (condition) { //do something } else if (condition) else //do something else

MIS 324 -- Professor Sandvig 11/7/2018 Control Structures 2. for statement increments a counter variable may declare within statement for (int i = 0; i <= 10; i++) { ViewBag.message += “value of i:” + i + “<br>”; }

MIS 324 -- Professor Sandvig 11/7/2018 Control Structures 3. foreach loop iterate through collections arrays, controls, cookies, etc. int[] intArray = {3, 5, 7, 9}; foreach (int item in intArray) { ViewBag.message += “Item: “ + item + “<br>”; }

MIS 324 -- Professor Sandvig 11/7/2018 Control Structures 4. while loop int i = 0; while (i < 5) { i += 1; }

MIS 324 -- Professor Sandvig 11/7/2018 Summary C# modern object oriented programing language Relatively easy to use Managed code C-like syntax (similar to PHP, JavaScript, C, C++) Strongly typed Explicitly convert data types Pick up syntax quickly Visual Studio big help