AUC Technologies Projects Consulting, Development, Mentoring, and Training Company.NET Basic Fundamentals Presented By : Muhammad Atif Hussain Deputy Manager.

Slides:



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

Object Oriented Programming with Java
Microsoft.NET Object Oriented Software Engineering Based on a presentation by Murat Can Ganiz.
Semantic Analysis Chapter 6. Two Flavors  Static (done during compile time) –C –Ada  Dynamic (done during run time) –LISP –Smalltalk  Optimization.
C# Language Report By Trevor Adams. Language History Developed by Microsoft Developed by Microsoft Principal Software Architect Principal Software Architect.
Language Fundamentals in brief C# - Introduction.
C# Types Tom Roeder CS fa. Administration CMS is up let me know if you can’t see the course Assignments are posted may not be able to do some.
12-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
C#: Data Types Based on slides by Joe Hummel. 2 UCN Technology: Computer Science Content: “.NET is designed around the CTS, or Common Type System.
Overview of the.NET Framework. What is the.NET Framework A new computing platform designed to simplify application development A consistent object-oriented.
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 versus C# An introduction to C# and Visual Studio.
Object-Oriented Programming: Inheritance
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Programming in C# Language Overview
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
Module 7: Object-Oriented Programming in Visual Basic .NET
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Variable, Expressions, Statements and Operators By: Engr. Faisal ur Rehman CE-105 Fall 2007.
C# Programming Fundamentals of Object-Oriented Programming Fundamentals of Object-Oriented Programming Introducing Microsoft.NET Introducing Microsoft.NET.
C#C# Classes & Methods CS3260 Dennis A. Fairclough Version 1.1 Classes & Methods CS3260 Dennis A. Fairclough Version 1.1.
Distributed Systems (236351) Tutorial 1 - Getting Started with Visual Studio C#.NET.
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
Introduction to Java University of Sunderland CSE301 Harry R. Erwin, PhD.
Lecture 2 Object Oriented Programming Basics of Java Language MBY.
Programming Pillars Introduction to Object- Oriented Programming.
Microsoft.NET Object Oriented Software Engineering Course Presentation Murat Can Ganiz 04/01/2004.
AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Application Foundation Presented By : Naveed Sattar Software Engineer.
These materials where developed by Martin Schray. Please feel free to use and modify them for non-commercial purposes. If you find them useful or would.
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.
AUC Technologies Projects Consulting, Development, Mentoring, and Training Company.NET Assemblies Presented By : Muhammad Atif Hussain Deputy Manager IT.
Applications Development
Introduction to Java COM379 (Part-Time) University of Sunderland Harry R Erwin, PhD.
Computing with C# and the.NET Framework Chapter 2 C# Programming Basics ©2003, 2011 Art Gittleman.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
CSCI 3328 Object Oriented Programming in C# Chapter 4: C# Control Statement – Part I 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX.
C# C1 CSC 298 Elements of C# code (part 1). C# C2 Style for identifiers  Identifier: class, method, property (defined shortly) or variable names  class,
C Sharp Web & Internet Programming Group Diana, Aren, Jeff, & Adam, Farrin 5/5/20081CS 311.
Bill Campbell, UMB Microsoft's.NET C# and The Common Language Runtime.
The .NET Framework - Technology in Education
Chapter 7: Class Inheritance F Superclasses and Subclasses F Keywords: super and this F Overriding methods F The Object Class F Modifiers: protected, final.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 8 th Lecture Pavel Ježek
Classes, Interfaces and Packages
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
- This slide is intentionally left blank - Some of the slides are based on University of Linz.NET presentations. © University of Linz, Institute for System.
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
1 C#. 2 C#’s Family Tree C# inherits a rich programming legacy from C (1972) and C++ (1979). It is closely related to Java (1991).
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 –
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
Java and C# - Some Commonalities Compile into machine-independent, language- independent code which runs in a managed execution environment Garbage Collection.
Value Types. 2 Objectives Discuss concept of value types –efficiency –memory management –value semantics –boxing –unboxing –simple types Introduce struct.
These materials where developed by Martin Schray
Introduction to the Microsoft.NET Framework Chris Wastchak Student Ambassador to Microsoft.
Basic Introduction to C#
C# - OOP TTU IT College , Autumn SEMESTER Andres käver.
Module 5: Common Type System
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
Application Foundation
Computing with C# and the .NET Framework
Structs.
OOP’S Concepts in C#.Net
Microsoft .NET Manjunath D R.
Object-Oriented Programming: Inheritance
Conditional Statements
Recap Week 2 and 3.
Module 2 Variables, Assignment, and Data Types
CIS 199 Final Review.
Java Programming Language
Presentation transcript:

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company.NET Basic Fundamentals Presented By : Muhammad Atif Hussain Deputy Manager IT (Takaful Pakistan Limited) Technologies Consultant (AUC Technologies) MCS(KU) MSCS(SZABIST) MCP MCAD MCSD MCTS (Windows, Web, Distributed Applications) MCPD (Enterprise Applications) MCT(Microsoft Certified Trainer)

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Overview of.NET Languages DataTypes Primitive Data Types Type Casting Arrays Multidimensional Arrays Basic Access Modifiers Abstract Data Types Variables Properties/Attributes Functions/Methods/Procedures OverLoading Agenda Constructors Inheritance Constructor Chaining Conditional Statememt Loops Namespaces Struct Enumerators Delegates Events

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Basic understanding of object oriented programming will help. Knowledge of C++ or Java or vb6 will help. Assumption

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company.NET languages provided by Microsoft –C++ –Visual Basic –C# –J# –F# (2010) Over 30.NET-compatible languages –Most are provided by 3 rd parties.NET Languages

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Ada APL Basic (Visual Basic) C# C C++ Java Language COBOL Component Pascal (Queensland Univ of Tech) ECMAScript (JScript) Eiffel (Monash University) Haskell (Utrecht University) lcc (MS Research Redmond) Mondrian (Utrecht) ML (MS Research Cambridge) Mercury (Melbourne U.) Oberon (Zurich University) Oz (Univ of Saarlandes) Perl Python Scheme (Northwestern U.) SmallTalk 3 rd Party Language Compiler List

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company TypeSize bool1 sbyte1 byte1 short2 ushort2 int4 uint4TypeSizelong8 ulong8 char2 float4 double8 decimal16 string20+ Primitive types

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company All Primitive types are objects Primitive Types are FCL Types –Aliases the primitives –Example: Int32 == int (C#) –Example: Int32 == Integer Primitive types

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Primitive types C#VBSizeMinimumMaximum sbyteSbyte byteByte10255 shortShort ushortUShort intInteger uintUInteger longLong ulongULong doubleDouble E E+308 decimalDecimal

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Move data of one data type to another Type Casting Long Integer Short Byte

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company No loss of data Byte b = 1 Short s = b Integer i = s Long l = i Implicit Type Casting byte b = 1; short s = b; int i = s; long l = I;

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Possible loss of precision Explicit Type Casting Short s = 256 Byte b = s short s = 256; byte b = s;

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Collection of similar type of Object Arrays are objects too! –ages.Length –ages.Clone() Arrays int[] x = new int[10]; int[] x = { 5, 8, 39 }; Dim x(10) As Integer Dim x() As Integer = {5, 8, 39}

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Rectangular Jagged Multidimensional Arrays int[,] x = new int[ 8, 8 ]; Dim x(10, 10) As Integer int[][] x= new int[2][]; x[0] = new int[ 4 ]; x[1] = new int[ 3 ]; Dim x(,) As Integer x(0, 0) = 1 x(1, 0) = 2 x(1, 1) = 3

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company User define data type Abstract Data Type Public Class Student End Class public class Student { }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Basic Access Modifiers FormMeaning public Access not limited. private Access limited to the containing type.

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Variables Properties Functions (Methods/Procedure/Sub Routine) Constructors Basic Members of Abstract Data Type

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Specific type Hold data temporarily for reuse Instance Variable / Local Variable Variables Short s = 256 Byte b = 100 short s = 256; byte b = 100;

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Get and Set Guard instance variables Read Only, Write Only and Both Properties Public Property Age() As Integer Get Return _age End Get Set(ByVal value As Integer) _age = value End Set End Property class Person { private int _age; public int Age { get { return _age; } set { _age = value; } }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Set of Instructions Function must return a value Function don’t return a value Functions Public Function Add(ByVal i As Integer, ByVal j As Integer) As Long Return i + j End Function public long Add(int i, int j) { return i + j; } Public Sub Print() Console.WriteLine("Name") End Sub public void Print() { Console.WriteLine("Name"); }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Number of Argument / Parameter Type of Argument / Parameter Arrangement of Argument / Parameter Functions Signature

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Same name of functions with different Signatures Functions Overloading Public Function Add(ByVal i As Integer, ByVal j As Integer) As Long Return i + j End Function Public Function Add(ByVal i As Integer, ByVal j As Integer, ByVal k As Integer) As Long Return i + j + k End Function public long Add(int i, int j) { return i + j; } public long Add(int i, int j, int k) { return i + j + k; }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Special type of functions Called once in the life of instance Initiate the instance of class in memory Initialize instance variable with their default values Constructors Public Class Person Sub New() End Sub End Class class MyClass { public MyClass() { } }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Same name of Constructor with different Signatures Constructor Overloading Public Function Add(ByVal i As Integer, ByVal j As Integer) As Long Return i + j End Function Public Function Add(ByVal i As Integer, ByVal j As Integer, ByVal k As Integer) As Long Return i + j + k End Function public long Add(int i, int j) { return i + j; } public long Add(int i, int j, int k) { return i + j + k; }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Classes can extend / inherit one class at a time Inheritance ManManWomanWoman HumanHuman

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Generalize common functionalities to base class Generalization Public Class Human Public Function Eat() End Function End Class Public Class Man Inherits Human End Class Public Class Woman Inherits Human End Class public class Human { public void Eat() { } public class Man : Human { } public class Woman : Human { }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Specialized specific functionalities to child class Specialization Public Class Human End Class Public Class Man Inherits Human Public Function Work() End Function End Class Public Class Woman Inherits Human Public Function Talk() End Function End Class public class Human {} public class Man : Human { public void Work() {} } public class Woman : Human { public void Talk() {} }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Extend base class functionalities in child class Overriding (Virtual / Overridable) Public Class Human Public Overridable Sub Sleep() End Sub End Class Public Class Woman Inherits Human Public Overrides Sub Sleep() End Sub End Class public class Human{ public virtual void Sleep() { } public class Woman : Human { public overrides void Sleep() { }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Extend base class abstract functionalities in child class Whole class will become abstract / MustInherit if contain any abstract / MustOverride function Overriding (Abstract / MustOverride) Public MustInherit Class Human Public MustOverride Sub Eat() End Class Public Class Woman Inherits Human Public Overrides Sub Eat() End Sub End Class public abstract class Human{ public abstract void Eat(); } public class Woman : Human { public overrides void Eat() { }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Shadowing base class functionalities in child class Shadowing Public Class Human Public Sub Walk() End Sub End Class Public Class Woman Inherits Human Public Shadows Sub Walk() End Sub End Class public class Human{ public void Walk(); } public class Woman : Human { public new void Walk() { }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Lock more Inheritance Sealed / NotInheritable Class Public Class Human End Class Public NotInheritable Class Woman Inherits Human End Class public class Human{ public void Walk(); } public sealed class Woman : Human { public new void Walk() { }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Every constructor calls its base class constructor first All types ultimately inherit from object –Classes, enums, arrays, delegates, structs, … Constructor Chaining StreamStream MemoryStreamMemoryStreamFileStreamFileStream HashTableHashTabledoubledoubleintint ObjectObject

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Constructor Chaining (Cont..) Public Class A Sub New Console.WriteLine(“A”) End Sub End Class Public Class B Inherits A Sub New Console.WriteLine(“B”) End Sub End Class public class A { public A() { Console.WriteLine(“A”); } public class B:A { public B() { Console.WriteLine(“B”); }

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Set of rules Can implements multiple interfaces in single class Interfaces HumanHuman ManManWomanWoman PlantPlantAnimalAnimal Living Thing Non Living Thing lilylilyRoseRoseLionLionTigerTiger Interfaces Abstract Classes Sealed Classes Sealed Classes

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company if(x == y) { // X is equal to Y } else { //X is not equal to Y } switch(x){ case 2: //x equals 2 break; default: //x does not equal 2 break;} Conditional Statements If x == y Then ‘ X is equal to Y Else ‘X is not equal to Y End If Select Case x Case 2 ‘x is equal to 2 Case Else ‘x is not equal to 2 End Select

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company x = 0; do{ Console.WriteLine(x); }while(x < 0); for(x = 0;x<100;x++) Console.Write(x); Loops x = 0; while(x != 10){ Console.WriteLine(x); x++; } x = 0 While x >= 10 Console.WriteLine(x) x++; End While x = 0 Do Console.WriteLine(x) Loop While x < 0 For x = 0 To 100 Console.WriteLine(x) Next

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Loops int[] x = new int[] { 10, 20, 30, 40 }; foreach (int i in x) { Console.WriteLine(i); } Dim x() As Integer = {10, 20, 30, 40} For Each i As Integer In x Console.WriteLine(i) Next foreach loop Iterates over arrays or any class that implements the IEnumerable interface

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Questions ?