Wel come To Seminar On C#.

Slides:



Advertisements
Similar presentations
pa 1 Porting BETA to ROTOR ROTOR Projects Presentation Day, June by Peter Andersen.
Advertisements

Microsoft. NET Eine neue Generation der Softwareentwicklung Klaus Rohe
METHOD OVERRIDING Sub class can override the methods defined by the super class. Overridden Methods in the sub classes should have same name, same signature.
METHOD OVERRIDING 1.Sub class can override the methods defined by the super class. 2.Overridden Methods in the sub classes should have same name, same.
Abstract Classes and Interfaces The objectives of this chapter are: To explore the concept of abstract classes To understand interfaces To understand the.
Exceptions Used to signal errors or unexpected situations to calling code Should not be used for problems that can be dealt with reasonably within local.
CPSC150 Inheritance Details Chapter 9. CPSC150 Print in Entertainment ver 2 (with inheritance): public void print() { System.out.print("title: " + title.
Names and Scopes CS 351. Program Binding We should be familiar with this notion. A variable is bound to a method or current block e.g in C++: namespace.
Revealing the CLR 4.0 Internals Svetlin Nakov Telerik Corporation
1 Chapter 6 Inheritance, Interfaces, and Abstract Classes.
Exam Objective : Legal return types PRESENTED BY : SRINIVAS VG.
Interfaces besides classes, Java recognizes another type, an interface interface is used to completely shield off all implementation from the programmer.
12.1 Exceptions The limitations of traditional methods of exception handling Error conditions are a certainty in programming Programmers make.
Types in programming languages What are types, and why do we need them? Types in programming languages1.
Java versus C# An introduction to C# and Visual Studio.
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.
Introduction to .Net Framework
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
220 FINAL TEST REVIEW SESSION Omar Abdelwahab. INHERITANCE AND POLYMORPHISM Suppose you have a class FunClass with public methods show, tell, and smile.
BASE CLASSES AND INHERITANCE CHAPTER 4. Engineer Class.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
.NET Framework & C#.
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
1 Review of Java Higher Level Language Concepts –Names and Reserved Words –Expressions and Precedence of Operators –Flow of Control – Selection –Flow of.
Java Implementation: Part 3 Software Construction Lecture 8.
Component-Based Software Engineering Introduction to.NET Paul Krause.
Java Introduction to JNI Prepared by Humaira Siddiqui.
ILM Proprietary and Confidential -
1 C# A brief overview by Jack Senechal and Bryan Powell.
Hoang Anh Viet Hà Nội University of Technology Chapter 1. Introduction to C# Programming.
1 Hammad Khan. Agenda.NET Framework Introduction to Visual C#
MCS 270 Spring 2014 Object-Oriented Software Development.
LECTURE 9: INTERFACES & ABSTRACT CLASSES CSC 212 – Data Structures.
Chapter 9 Questions 1. What are the difference between constructors and member functions? 2. Design and implement a simple class as you want, with constructors.
C# Classes and Inheritance CNS 3260 C#.NET Software Development.
JAVA COURSE 1 Computer Engineering Association. Compile your first program Public class Hello{ public class Hello(){ System.out.println(“Hello”); } puclic.
Copyright © 2015 Curt Hill Java for Minecraft Those things you should know.
Pengantar OOP Class-Java. 2 Software Development Tools Using Sun Java SDK alone Source File(s) (.java) Programmer Compiler (javac) Class File(s) (.class)
QT Programming QT Programming Ruku Roychowdhury. Background QT is a cross platform application framework. Widely used to develop GUI applications. Originally.
Overview of Java CSCI 392 Day One. Running C code vs Java code C Source Code C Compiler Object File (machine code) Library Files Linker Executable File.
Recitation 8 User Defined Classes Part 2. Class vs. Instance methods Compare the Math and String class methods that we have used: – Math.pow(2,3); – str.charAt(4);
C# and.NET. .NET Architecture  Compiling and running code that targets.NET  Advantages of Microsoft Intermediate Language (MSIL)  Value and Reference.
Access Modifiers Control which classes use a feature Only class-level variables may be controlled by access modifiers Modifiers 1. public 2. protected.
INTRODUCTION CHAPTER #1 Visual Basic.NET. VB.Net General features It is an object oriented language  In the past VB had objects but focus was not placed.
Interfaces, Abstract Classes, and Polymorphism. What Is an Interface? An interface is the set of public methods in a class Java provides the syntax for.
CSI 3125, Preliminaries, page 1 Inheritance. CSI 3125, Preliminaries, page 2 Inheritance Using inheritance, can create a general class that defines traits.
The Execution System1. 2 Introduction Managed code and managed data qualify code or data that executes in cooperation with the execution engine The execution.
OOP in Java : © W. Milner 2005 : Slide 1 Java and OOP Part 3 – Extending classes.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
Reference Types CSE301 University of Sunderland Harry R Erwin, PhD.
Methods What is a method? Main Method the main method is where a stand alone Java program normally begins execution common compile error, trying.
Java and C# - Some Commonalities Compile into machine-independent, language- independent code which runs in a managed execution environment Garbage Collection.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Modern Programming Tools And Techniques-I
Java Yingcai Xiao.
using System; namespace Demo01 { class Program
Foundations of .Net Programming with C#
Inheritance and Polymorphism
EKT 472: Object Oriented Programming
C# and the .NET Framework
CS360 Windows Programming
Introduction to C# AKEEL AHMED.
OOP’S Concepts in C#.Net
Java Programming Language
Conditional Statements
Chapter 14 Abstract Classes and Interfaces
Abstract Classes and Interfaces
OOP Aga private institute for computer science 5th grade
Abstract Classes and Interfaces
Presentation transcript:

Wel come To Seminar On C#

.Net Framework Consists of Two things CLR(common language Runtime) Framework above OS Handles execution of .Net Applications while maintaining performance FCL(Framework Class Library) Thousands of Classes for Network Prog, Data access ,Threads ,common DS, etc Pure OO design

MSIL(Microsoft Intermediate Lang.) Prog .in any .Net language is converted to MSIL first & not into native code Os & hardware independent code Interpreted by CLR Similar for all .Net Language.

.Net Languages How to decide ? C# , C ,C++ ,Java Script ,VB , etc CLS(common language specification) # small set of Rules Eg. no global func decl , no pointers ,no multiple inheritance, etc CTS(Common Type System) # set of standards Eg Every .net lang. must hav some basic datatypes

JIT(Just in time ) compiler Using JIT , CLR converts MSIL code into native executable code Aware of each OS so can optimize code & makes Robust applications Reuses the code when used again So performance increases when program is run for a long time

Operating System Services CLR Execution model VB Source code Compiler C++ C# Assembly IL Code Operating System Services Common Language Runtime JIT Compiler Native Code Managed code Unmanaged Component

Evolution of C# C++ Gave performance & efficiency BUT No automatic Garbage collector Difficult to handle very large program Hard to work at windows application level VB  easy to work at windows appli. Level difficult to work at system level

Class & objects Similar to structure but with difference Has attributes & methods Eg. Class Fruit { int price; float weight; public void getAttrib(); } Attributes (characteristics) price, weight Method( behaviour) getAttrib() Fruit mango; mango is reference to class mango =new Fruit( );  mango refers to an object of class Fruit & contains address of that object

A Short Program using System; namespace Me { class Hello String name=“Yash”; static void Main( ) Console.WriteLine("Hello world"); console.WriteLine(“Hello {0}”,name); } // Main ends } // class Hello ends } // namespace Me ends

Understanding concepts Namespace Collection of logically related classes similar to concept of Package in JAVA difference :-Unlike JAVA ,Classes of same namespace may not be in same folder Main Advantage Prevents name conflicts of classes in program Here Me is the namespace So in future if we want to reuse class Hello we can use by calling it as Me.Hello

Understanding concepts Using Keyword Similar to import keyword in JAVA Tells program which classes r to be used Here Eg. using System –tells program that we want to make use of classes inside system namespace but remember that does not include classes inside sub namespaces just like Java

Understanding concepts Main Method Unlike JAVA & C , there can be more than one main method in a C# program But execution will start from the main method with capital ‘M’ Unlike JAVA , Name of the program need not be same as class name containing Main ().

Understanding concepts Console Class Class of System Namespace Methods WriteLine() = printf( ) , ReadLine() = scanf( ) Eg. WriteLine( “ Hello {0} , How r u ? ”, name ) ; printf in C OR WriteLine(“Hello “+name+” , How r u ? “) ;  println in JAVA

Diff . Bet’n Structure & Class value type while class is of reference type may contain constructor except no argument constructor neither inherit another class nor can they be implemented can implement interfaces implicitely inherited from System.Object class instances can be created with or without using new keyword When kept small in size a struct is more efficiently used by the system than class  

Abstract class an incomplete class one or more abstract (incomplete methods) i,.e method with signature but no implementation can’t be instantiated i.e its object can’t be created but reference can be Can be inherited Its subclass must implement all abst. Methods of Abstract class Eg . Abstract class A { int a1; public abstract int add(int x , int y); } class B : A { int b1; public int add(int x, int y) { int z=x+y; return z; if A a = new A( );  Error

Object Oriented Language Inheritance Eg . Class A { int a1; int a2; public void Get(); } Class B : A

Object Oriented Language Inheritance Like Java & unlike C++ , C# does not allow multiple inheritance The Object class defined in System namespace is the ultimate base of each class Interfaces in C# can inherit more than one interface  Sealed keyword prevents class from being inherited = final keyword in Java

Access Modifiers Private-can be accessed within the class Protected-can be accessed from the containing class & types inherited from them Public-Anyone can access Protected internal - anything within the project can access or types inherited from them Internal-anything within the project can access cannot apply acces modifiers to namespaces

properties Built in support for accessing private members of a class Suppose “name “ is one of the private fields of class Public string Name { Get return name; } Set Name=value; Use method - stu.Name = “Yash” ; correct stu.name=“Yash”; incorrect Convention – Property must be of same name as field name but with letter as capital letter

delegates reference to a methods Similar to function pointer concept in C & C++ Delegates can be made to a signature of method Three Properties of Delegate 1-signature of method that a delegate points to Eg. int Add(int a, int b); int Sub(int c, int d); Here both methods have same signature So delegate int Mydelegate(int a, int b); 2- reference of delegate that points to a method Mydelegate arith; 3-Actual methods reference by the delegate arith = new Mydelegate(Add);

Exception handling Exceptions- They r the runtime errors causing the program to terminate prematurely Eg Public void Main() { int d=2; int c=0; program will terminate unexpectedly To prevent this Exception Handling is used Mechanism System.Exception - Base class for all exceptions Throw keyword – Methods can throw exception explicitly “Try” and “catch” block should be used . Single try block is not allowed suspected code must be in Try block while measures to handle exception must be in catch block

Mechanism (cont.) Exception handling finally – code must be executed whether exceptions occur or not Eg. Freeing of resources, closing opened files, etc If we miss, CLR will handle exception for us 