ITF11006.NET The Basics. Data Types – Value Types – Reference Types Flow Control – Conditional – Loop Miscellaneous – Enumerations – Namespaces Class.

Slides:



Advertisements
Similar presentations
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 12 th -13 th Lecture Pavel Ježek.
Advertisements

C# Language Report By Trevor Adams. Language History Developed by Microsoft Developed by Microsoft Principal Software Architect Principal Software Architect.
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
Introduction to the C# Programming Language for the VB Programmer.
True or false A variable of type char can hold the value 301. ( F )
COMP1180 Review Date: 4 March, 2009 Time: 10:30am - 12:20pm Venue: –CS students -- FSC801C and FSC801D –IS and other students -- OEE1017 Remarks: – 1)
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
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++
Java Syntax Primitive data types Operators Control statements.
C#. First Program  MyFirstProgram.cs MyFirstProgram.cs.
General Computer Science for Engineers CISC 106 Lecture 33 Dr. John Cavazos Computer and Information Sciences 05/11/2009.
Programming in C# Language Overview
C# vs. C++ What's Different & What's New. An example C# public sometype myfn { get; set; } C++ public: sometype myfn { sometype get (); void set (sometype.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 7 th & 8 th Lecture Pavel Ježek.
CS 192 Lecture 3 Winter 2003 December 5, 2003 Dr. Shafay Shamail.
COMPUTER PROGRAMMING. Data Types “Hello world” program Does it do a useful work? Writing several lines of code. Compiling the program. Executing the program.
1 Identifiers  Identifiers are the words a programmer uses in a program  An identifier can be made up of letters, digits, the underscore character (
Chap 3 – PHP Quick Start COMP RL Professor Mattos.
General Features of Java Programming Language Variables and Data Types Operators Expressions Control Flow Statements.
C#C# Classes & Methods CS3260 Dennis A. Fairclough Version 1.1 Classes & Methods CS3260 Dennis A. Fairclough Version 1.1.
C Tokens Identifiers Keywords Constants Operators Special symbols.
C-Language Keywords(C99)
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
1 Advanced Programming IF. 2 Control Structures Program of control –Program performs one statement then goes to next line Sequential execution –Different.
STATEMENTS AND FLOW OF EXECUTION CHAPTER 11 OF APRESS A PROGRAMMERS GUIDE TO C SHARP 5.0.
ILM Proprietary and Confidential -
Page: 1 การโปรแกรมเชิงวัตถุด้วยภาษา JAVA บุรินทร์ รุจจนพันธุ์.. ปรับปรุง 15 มิถุนายน 2552 Keyword & Data Type มหาวิทยาลัยเนชั่น.
CompSci 100E 2.1 Java Basics - Expressions  Literals  A literal is a constant value also called a self-defining term  Possibilities: o Object: null,
COMPUTER PROGRAMMING. variable What is variable? a portion of memory to store a determined value. Each variable needs an identifier that distinguishes.
Chapters 1-5 Review C++ Class. Chapter 1 – the big picture Objects Class Inheritance Reusability Polymorphism and Overloading.
Computing with C# and the.NET Framework Chapter 2 C# Programming Basics ©2003, 2011 Art Gittleman.
Variables and Data Types.  Variable: Portion of memory for storing a determined value.  Could be numerical, could be character or sequence of characters.
Bill Campbell, UMB Microsoft's.NET C# and The Common Language Runtime.
Principles of Object-Oriented Software Development The language C++
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 8 th Lecture Pavel Ježek
Lecture 8: Object Oriented Programming. What is a Programming Object? An object is an instance of a class. A class is a template for an object. Everything's.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
CNS 3260 C# .NET Software Development
Chapter One Lesson Three DATA TYPES ©
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 06 – Java Datatypes Webpage:
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
Introduction to C# Anders Hejlsberg Distinguished Engineer Developer Division Microsoft Corporation.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
1 CSC 1111 Introduction to Computing using C++ C++ Basics (Part 1)
Data Types References:  Data Type:  In computer science and computer programming, a data type or simply type is a.
JAVA Programming (Session 2) “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
Introduction C# program is collection of classes Classes are collection of methods and some statements That statements contains tokens C# includes five.
C syntax (simplified) BNF. Program ::= [ ] Directives ::= [ ] ::= | |… ::=#include > ::=#define.
Conditional Statements A conditional statement lets us choose which statement will be executed next Conditional statements give us the power to make basic.
C++ Lesson 1.
Asst.Prof.Dr. Tayfun ÖZGÜR
Basic Introduction to C#
Data types Data types Basic types
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
Computing with C# and the .NET Framework
Chapter 3: Understanding C# Language Fundamentals
Reserved Words.
Starting JavaProgramming
EEC-693/793 Applied Computer Vision with Depth Cameras
null, true, and false are also reserved.
Conditional Statements
Prof. Bhushan Trivedi Director GLS Institute of Computer Technology
Module 2 Variables, Assignment, and Data Types
2. Second Step for Learning C++ Programming • Data Type • Char • Float
Programming Language C Language.
CIS 199 Final Review.
Chap 2. Identifiers, Keywords, and Types
- This slide is intentionally left blank -
Chengyu Sun California State University, Los Angeles
Presentation transcript:

ITF11006.NET The Basics

Data Types – Value Types – Reference Types Flow Control – Conditional – Loop Miscellaneous – Enumerations – Namespaces Class / Struct – Data Members – Functional Mem Base Classes – System.Object – System.String

Variables/Constants Syntax [modifier] type identifier [= expression]; Scope – Class/Block Constants [modifier] const type identifier [= constant-expression]; Type Inference var identifier [= expression];

Predefined Data Types Value Types Reference Types

Predefined Data Types Value Types – Integer Types – Floating Point Types – Decimal Type – Boolean Type – Character Type

Integer Types C# data typeDescriptionClass nameRange sbyteA 8-bit signed integer.System.SByte-128:127 shortA 16-bit signed integer.System.Int : intA 32-bit signed integer.System.Int : longA 64-bit signed integer.System.Int : byteAn 8-bit unsigned integer.System.Byte0:255 ushortA 16-bit unsigned integer.System.UInt160:65535 uintA 32-bit unsigned integer.System.UInt320: ulongA 64-bit unsigned integer.System.UInt640:

Floating Point C# data typeDescriptionClass nameSignificant fig.Range floatA single-precision (32-bit) floating-point number. System.Single7+1.5x to +3.4x10 38 doubleA double-precision (64-bit) floating-point number. System.Double15/16+5.0x to +1.7x10 308

Decimal Type C# data typeDescriptionClass nameSignificant fig.Range decimalA 96-bit decimal value. (128 bit space!) System.Decimal28+1.0x to +7.9x10 28

Boolean Type C# data typeDescriptionClass nameRange boolLogical true or falseSystem.Booleantrue or false

Character Type C# data typeDescriptionClass name char16 bits. Represents a single (Unicode) characterSystem.Char

Nullable Types ( T? or System.Nullable(Of T) Ordinary type plus null

Predefined Reference Types Object String

Flow Control Conditional – if – switch Loop – for – while – do..while – foreach Jump – goto – break – continue – return

Conditional Statements if if (expression) statement1 [else statement2] switch switch (expression) { case constant-expression: statement jump-statement [default: statement jump-statement] }

Loops for for ([initializers]; [expression]; [iterators]) statement while while (expression) statement do..while do statement while (expression); foreach foreach (type identifier in expression) statement

Jump Statements goto break continue return (throw)

Enumerations enum [modifiers] enum identifier [:base-type] {enumerator-list} Inherits from System.Enum Flags Attribute Use enumerations

Namespaces Logical grouping of functionality. Using directive

Class (/Struct) Data Members – Fields – Constants – Events Function Members – Methods – Properties – Constructor – Destructor – Operators – Indexers

Methods syntax [modifiers] return-type method-name([formal-parameter-list]) { statement(s) } Named Arguments string FullName(string firstName, string lastName)… FullName(“Ole”, “Olsen”); FullName(lastName: “Olsen”, firstName: “Ole”); Optional Arguments Method Overloading

Properties syntax [modifiers] type identifier { set {accessor-body} get {accessor-body} } Auto-Implemented public string Age(get; private set;) Choosing Between Properties and Methods

Construction and Disposal Constructors – Instance – Class – Calling Destructor – Why – How (pattern) Dispose vs. Close

Operators Operator Overloading public static Vector operator * (double lhs, Vector rhs) { return new Vector(lhs * rhs.x, lhs * rhs.y, lhs * rhs.z); } public static Vector operator * (Vector lhs, double rhs) { return rhs * lhs; } Console.WriteLine("vect2 * 2 = " + ( vect2 * 2).ToString());

Indexers public char this[int index] { get {... } set {... }

Instance vs. Class Level Static this vs. class name

Struct No inheritance (almost) Constructors Fields are sometimes declared public! Structs are value types

Struct vs. class Footprint Performance

object (System.Object) Methods Comparing for Equality – Reference Types – Value Types MethodAccess string ToString()public virtual int GetHashCode()public virtual bool Equals(object obj)public virtual bool Equals(object objA, object objB)public static bool ReferenceEquals(object objA, object objB)public static Type GetType()public object MemberwiseClone()protected void Finalize()protected virtual

string (System.String) Building Strings – string vs. StringBuilder Formatting – IFormattable Regular Expressions – Matches – Groups – Captures