C#C# C using System; public class MyClass } public static void Main() { Console.WriteLine("Hello, World!"); } } using System; public class MyClass } public.

Slides:



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

CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 12 th -13 th Lecture Pavel Ježek.
C# Language Report By Trevor Adams. Language History Developed by Microsoft Developed by Microsoft Principal Software Architect Principal Software Architect.
CS 4800 By Brandon Andrews.  Specifications  Goals  Applications  Design Steps  Testing.
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++
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++
C#: Project Cool Arthur Ketchel II Keith Francisco Chris McInnis.
Java CourseWinter 2009/10. Introduction Object oriented, imperative programming language. Developed: Inspired by C++ programming language.
Java versus C# An introduction to C# and Visual Studio.
Java vs. C# By Abrar Siddiqui.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Programming in C# Language Overview
C# Tutorial From C++ to C#. Some useful links Msdn C# us/library/kx37x362.aspxhttp://msdn.microsoft.com/en- us/library/kx37x362.aspx.
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.
Inheritance. Types of Inheritance Implementation inheritance means that a type derives from a base type, taking all the base type’s member fields and.
SEG Object Oriented Analysis, Design and Programming
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 7 th & 8 th Lecture Pavel Ježek.
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
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.
C#C# Introduction CS3260 Dennis A. Fairclough Version 1.0 Introduction CS3260 Dennis A. Fairclough Version 1.0.
C# D1 CSC 298 Elements of C# code (part 2). C# D2 Writing a class (or a struct)  Similarly to Java or C++  Fields: to hold the class data  Methods:
ILM Proprietary and Confidential -
Java 5 Part 1 CSE301 University of Sunderland Harry Erwin, PhD.
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.
Introduction to C#. Why C#? Develop on the Following Platforms ASP.NET Native Windows Windows 8 / 8.1 Windows Phone WPF Android (Xamarin) iOS (Xamarin)
C# Classes and Inheritance CNS 3260 C#.NET Software Development.
Computing with C# and the.NET Framework Chapter 2 C# Programming Basics ©2003, 2011 Art Gittleman.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
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# part II Delegates and Events Delegates and Events Dynamic functions Dynamic functions Extension methods Extension methods Closures Closures.
ITF11006.NET The Basics. Data Types – Value Types – Reference Types Flow Control – Conditional – Loop Miscellaneous – Enumerations – Namespaces 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.
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
Object-Oriented Programming Chapter Chapter
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 6 th Lecture Pavel Ježek
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 8 th Lecture Pavel Ježek
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 9 th Lecture Pavel Ježek
Introduction to C# By: Abir Ghattas Michel Barakat.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 4 th Lecture Pavel Ježek
Java & C++ Comparisons How important are classes and objects?? What mechanisms exist for input and output?? Are references and pointers the same thing??
Introduction to C# Anders Hejlsberg Distinguished Engineer Developer Division Microsoft Corporation.
- This slide is intentionally left blank - Some of the slides are based on University of Linz.NET presentations. © University of Linz, Institute for System.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 7 th Lecture Pavel Ježek
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 –
Introduction C# program is collection of classes Classes are collection of methods and some statements That statements contains tokens C# includes five.
Java and C# - Some Commonalities Compile into machine-independent, language- independent code which runs in a managed execution environment Garbage Collection.
C# for C++ Programmers 1.
Basic Introduction to C#
JAVA MULTIPLE CHOICE QUESTION.
Inheritance and Polymorphism
University of Central Florida COP 3330 Object Oriented Programming
Computing with C# and the .NET Framework
Structs.
CS360 Windows Programming
C# In many ways, C# looks similar to Java
.NET and .NET Core 5.2 Type Operations Pan Wuming 2016.
Java Programming Language
C# part I C:\> csc hello.cs … … C:\> hello.exe Hello, World!
CIS 199 Final Review.
Java Programming Language
- This slide is intentionally left blank -
Presentation transcript:

C#C# C using System; public class MyClass } public static void Main() { Console.WriteLine("Hello, World!"); } } using System; public class MyClass } public static void Main() { Console.WriteLine("Hello, World!"); } } hello.cs C:\> csc hello.cs … … C:\> hello.exe Hello, World!

2 Genealogy Designer: Anders Hejlsberg (Microsoft) –Designer of Turbo Pascal, Visual J++, Delphi (Borland) C Dynasty: Play on Words –C++ increment C by one. –C# the musical note half tone above C Yet another curly bracket programming language –Grouping: {} –Terminstic camp: statements terminated by ";" –C operators: ++ % != += && & ^, >>, ?: … –C like control: if () … else … for (…; …; …) … break … also multi-level break while (…) … continue … also multi-level continue do … while (…) switch (…) … case … default no fall through, also switch on strings

3 Design Principles All the Good Things: –Simplicity, General Purpose, Portability, Object Oriented Programmer Protection: –Strong Nominative Typing –Array Bounds Checking –Garbage Collection –Check against using uninitialized variables –No "hiding" by inner scopes Evolutionary: dramatic changes in each language version –Learn from Java mistakes: (no checked exceptions, since Anders Hejlsberg doesn't know yet how to do these right) Efficiency: Not at any price Better Java? –Developed by Microsoft –Compiles to the CLR "Common Language Interface" –Support for "unsafe" features, including pointers.

4 Pre-Defined Types Integral Types (signed and unsigned version) : byte, sbyte, short, ushort, int, uint, long, ulong May cause conversion problems. Most programmers like byte to be unsigned. Real Numbers: float, double, decimal (28 digits) Other: bool, char (unicode), string (immutable unicode),

5 Value/Reference Semantics Value Types –Simple types: char, int, float, … –Enum types –Struct types Reference Types –Classes, Interfaces, Delegates Nullable Value Types public enum Color {Red, Blue, Green} public struct Point { public int x, y; } char? c = eof() ? null : getchar(); if (c == null) … char c = c ?? ' ';

6 Object Oriented Purity Global Variables? No. –All variables are defined in functions/classes. Global Routines? No. –All routines (functions) are defined in classes. Non OO Types? No. –Even primitive types belong in the OO hierarchy. OO Control Flow? No. –If, while, for, … are imperative statements Preprocessor? Yes. (a good preprocessor can be used to defeat any paradigm) –Allows variables, but not parameterized macros.

7 Inheritance Hierarchy Classes: –Single Inheritance –Common root: System.Object –Unified type system: includes all builtin types (except for void ) System.ValueType: base class of all value types –Implementation by seamless auto-boxing and auto-unboxing. System.Enum : base class of all enum types System.Array : base class of all arrays … –Unextendable classes: denoted by keyword sealed –Static classe: denoted by keyword static No non-static members Must inherit form System.Object Interfaces: –Multiple Inheritance hierarchy –May be implemented by classes and structs Structs: no inheritance, but may implement interfaces.

8 Reflection 3 Levels: similar to Java and little-Smallatk using System; using System.Reflection; public static class FindLevels { private static void traverse(Object o) { for (int n = 0; ; o = o.GetType()) { Console.WriteLine( "L"+ ++n + ": " + o + ".GetType() = " + o.GetType()); if (o == o.GetType()) break; } } public static void Main() { traverse ( ); } } using System; using System.Reflection; public static class FindLevels { private static void traverse(Object o) { for (int n = 0; ; o = o.GetType()) { Console.WriteLine( "L"+ ++n + ": " + o + ".GetType() = " + o.GetType()); if (o == o.GetType()) break; } } public static void Main() { traverse ( ); } } L1: GetType() = System.Double L2: System.Double.GetType() = System.RuntimeType L3: System.RuntimeType.GetType() = System.RuntimeType

9 Exploring Hierarchy with Reflection using System; using System.Reflection; public static class FindSuperTypes { private static String pName(Type t) { return t.BaseType == null ? "null" : t. BaseType.ToString(); } private static void ancestory(Object o) { for (Type t = o.GetType(); t != null ; t = t. BaseType ) Console.WriteLine(t + " inherits from " + pName(t)); } public static void Main() { ancestory( GetType()); } } using System; using System.Reflection; public static class FindSuperTypes { private static String pName(Type t) { return t.BaseType == null ? "null" : t. BaseType.ToString(); } private static void ancestory(Object o) { for (Type t = o.GetType(); t != null ; t = t. BaseType ) Console.WriteLine(t + " inherits from " + pName(t)); } public static void Main() { ancestory( GetType()); } } System.RuntimeType inherits from System.Type System.Type inherits from System.Reflection.MemberInfo System.Reflection.MemberInfo inherits from System.Object System.Object inherits from null

10 Covariance Suppose B is a subtype of A: then an array of B is a subtype of an array of A. Like Java, unlike C++. Runtime type checking: in assignments to array elements. No Array Covariance of Value types. Object a[] = new int[5]; // error Method arguments and return type are no- variant. class A{}; void f(A[] a) { a[0] = new A();// OK ? } class B: A {} // Legal assignment A[] x = new B[]; // Legal call f(x);

11 A Universal Dump Array Function class EM: ICloneable { // Will dump any array thanks to array co-variance public static void print( String title, Object[] array) { if (array.Length == 0) return; Console.WriteLine(title + ":"); foreach (Object item in array) Console.WriteLine(" " + item); Console.WriteLine(); } // No co-variance of return type of methods public Object Clone() { return new EM(); } … } class EM: ICloneable { // Will dump any array thanks to array co-variance public static void print( String title, Object[] array) { if (array.Length == 0) return; Console.WriteLine(title + ":"); foreach (Object item in array) Console.WriteLine(" " + item); Console.WriteLine(); } // No co-variance of return type of methods public Object Clone() { return new EM(); } … }

12 Accessibility Five Levels –public Unlimited access –protected This class and all subclasses –internal Classes define in this "assembly" –protected internal This assembly and subclasses Nicknamed internal public –private This class only Default Levels –namespace public –enum public –class private –interface public –struct private –others internal

13 Class/Struct Member Kinds Instance Constructors: similar to C++/Java constructors –Dynamic binding within constructors Finalizer: Syntax as C++ destructor; semantics as Java finalizer. Static Constructors: similar to Java static initiliazers Constants: value computed at compile time –implicitly static Instance Fields: like Java/C++ Instance Readonly Fields: with readonly keyword –initialized by constructor / static constructor Static Fields: with static keyword Static Readonly Fields: Initialized by static constructor only Methods & Static Methods: like Java/C++ Properties (and static properties): field access implemented by methods Indexers: array access implemented by methods Events (and Static Events): more on these later

14 Investigating Member Kinds public class EM: ICloneable { public static void print(…) { … } public Object Clone() { … } static readonly public String NL = "\n"; public static void Main() { Type t = new EM().GetType(); Console.WriteLine(t+": "+t.Attributes + NL); print("Constructors", t.GetConstructors()); print("Methods", t.GetMethods()); print("Properties", t.GetProperties()); print("Fields", t.GetFields()); print("Events", t.GetEvents()); print("Interfaces", t.GetInterfaces()); } { public class EM: ICloneable { public static void print(…) { … } public Object Clone() { … } static readonly public String NL = "\n"; public static void Main() { Type t = new EM().GetType(); Console.WriteLine(t+": "+t.Attributes + NL); print("Constructors", t.GetConstructors()); print("Methods", t.GetMethods()); print("Properties", t.GetProperties()); print("Fields", t.GetFields()); print("Events", t.GetEvents()); print("Interfaces", t.GetInterfaces()); } {

15 Reflection Information EM: AutoLayout, AnsiClass, Class, Public, BeforeFieldInit Constructors: Void.ctor() Methods: Void print(System.String, System.Object[]) System.Object Clone() Void Main() System.Type GetType() System.String ToString() Boolean Equals(System.Object) Int32 GetHashCode() Fields: System.String NL Interfaces: System.ICloneable

16 Properties public struct Window { public int n_read = 0; private string title; public string Title { // read-write property get { // property getter method n_read++; return title; } set { // property setter method if (title != value)// implicit parameter return; title = value; redraw(); } } … { public struct Window { public int n_read = 0; private string title; public string Title { // read-write property get { // property getter method n_read++; return title; } set { // property setter method if (title != value)// implicit parameter return; title = value; redraw(); } } … { Property: a field implemented with methods Varieties: read only, write only, read-write Contextual keywords: get, set, value ( also add and del for events) –Provide specific meaning in the code –Not reserved words Window w = new Window("Initial Title"); Console.WriteLine(w.Title);// increment n_read w.Title = "My Title"; // redraw Window w = new Window("Initial Title"); Console.WriteLine(w.Title);// increment n_read w.Title = "My Title"; // redraw

17 Static Properties public struct HarryPotterBook { static private int count; static HarryPotterBook() {// static constructor count = she_wrote_it() ? 7 : 6; } static public int Count { // read-only static property get { return count; } } … { public struct HarryPotterBook { static private int count; static HarryPotterBook() {// static constructor count = she_wrote_it() ? 7 : 6; } static public int Count { // read-only static property get { return count; } } … {

18 Static Members A Node With a Static Allocator A List Using the Static Allocator class Node { public Node Next; public String Key; public Object Data; public Node(Node next) : this(null, null, next) { } public Node(String key, Object data, Node next) { Key = key; Data = data; Next = next; } static public Node Allocate(uint n) { return n == 0 ? null : new Node(Allocate(n - 1)); } class Node { public Node Next; public String Key; public Object Data; public Node(Node next) : this(null, null, next) { } public Node(String key, Object data, Node next) { Key = key; Data = data; Next = next; } static public Node Allocate(uint n) { return n == 0 ? null : new Node(Allocate(n - 1)); } class List { private Node first; public List(uint n) { first = Node.Allocate(n); } … { class List { private Node first; public List(uint n) { first = Node.Allocate(n); } … {

19 Indexers Purpose: Implement array access with methods Similar to properties (though no static indexers) –Syntax: modifiers returnType this[ IndexType pos] –Variations: multi-parameters indexers read-only, write-only and read-write indexers overloaded indexers class List { … private Node nth(Node n, uint d) { if (n == null) throw new Exception("out of range"); return d == 0 ? n : nth(n.Next,d-1); } public Object this[uint i] { // indexer using ordinal position get { return nth(first, i).Data; } set { nth(first,i).Data = value; } } … } class List { … private Node nth(Node n, uint d) { if (n == null) throw new Exception("out of range"); return d == 0 ? n : nth(n.Next,d-1); } public Object this[uint i] { // indexer using ordinal position get { return nth(first, i).Data; } set { nth(first,i).Data = value; } } … }

20 Using the Indexer class List { static void Main() { const uint n = 5; List sq = new List(n); for (uint i = 0; i < n; i++) sq[i] = i * i; for (uint i = 0; i < n; i++) Console.WriteLine(i + "^2 = " + sq[i]); } } class List { static void Main() { const uint n = 5; List sq = new List(n); for (uint i = 0; i < n; i++) sq[i] = i * i; for (uint i = 0; i < n; i++) Console.WriteLine(i + "^2 = " + sq[i]); } } 0^2 = 0 1^2 = 1 2^2 = 4 3^2 = 9 4^2 = 16

21 Indexer Overloading public class List { … private static Node find(Node n, String k) { if (n == null) return null; return n.Key.Equals(k) ? n : find(n.Next,k); } public Object this[String k] { // indexer using key get { Node n = find(first, k); return n != null ? n.Data : null; } set { Node n = find(first, k); if (n != null) n.Data = value; else first = new Node(k, value, first); }

22 Using String Indexer class List { static void Main() { … List capitals = new List(0); capitals["Israel"] = "Jerusaelm"; capitals["Iraq"] = "Bagdad"; Console.WriteLine(capitals["Israel"]); } } class List { static void Main() { … List capitals = new List(0); capitals["Israel"] = "Jerusaelm"; capitals["Iraq"] = "Bagdad"; Console.WriteLine(capitals["Israel"]); } } Jerusalem

23 Inheritance and Binding Method Binding: static, unless method is declared virtual –virtual modifier cannot go with any of static, abstract, private or override modifiers. –Properties can be virtual Overriding: inheritance is strict by default. –Overriding methods must be declared as such with override keyword –Cannot override non-virtual functions –Use new modifier to indicate hiding Sealing: use sealed keyword to indicate that an overriding function cannot be overridden further –No point in sealing a "plain" virtual function.

24 Events and Delegates C# Terminology –Event: a field representing a multi-set of delegates Defined with event keyword Operations –Add delegate using += operator += has default implementation, but user can provide his own add. –Remove delegate using -= operator -= has a default implementation, but user can provide his own del. –Call all delegates in the multi-set –Delegate: type safe function pointer defined with delegate keyword part of the class hierarchy Classical Example: when a button is pressed, listeners should be notified with "callback functions" Our Example: royal social conduct –If King is happy: notify all men in the kingdom –If King is ill: notify noblemen only.

25 Kingdom namespace King, Nobleman and Citizens Man abstract Citizen sealed Nobleman concrete King concrete Life static Name: every man has a name Title: every man has a title, based on his status and name –Realized by method ToString() Service: every man can be set to service any number of kings. –Method service(King k) in class Person State enum Notify delegate

26 Delegate Notify Type Definition: pointer to a function (to be called when a king changes his state) namespace Kingdom { delegate Object Notify(King k); … } Simple (uninteresting) use: void foo() { Notify bar; // A variable of type Notify bar = new Notify( FunctionDescriptor ); … Object o = bar(); // Invoke FunctionDescriptor } More interesting use: class Foo { event Notify baz; // A multi-set of variables of type Notify public void foo() { baz += new Notify( FunctionDescriptor ); … Object o = baz(); // Invoke FunctionDescriptor } } Notify delegate

27 Class King and Enum State namespace Kingdom { … enum State { happy, ill }; class King : Man { public State s; public King(String name): base(name){ s = State.ill; } sealed override public String ToString() { return "His Majesty, King " + Name; } // public multi-sets of those interested in the King's being. public event Notify when_ill, when_happy; public Object become_ill() { // returns last listener return value state = State.ill; return when_ill != null ? when_ill(this) : null; } public void become_happy() { // returns last listener return value state = State.happy; return when_happy != null ? when_happy(this) : null; } … } State enum King concrete

28 Class Man namespace Kingdom { abstract class Man { protected readonly String Name; public Man(String name) { Name = name; } abstract override public String ToString(); // Every man is happy when a King he serves is happy. virtual public void serve(King k) { k.when_happy += new Notify(happy); } public void happy(Object other) { Console.WriteLine(this + " is happy to hear that " + other + " is happy."); } {... } Man abstract

29 Delegates and Events Delegate type definition: pointer to a function (to be called when a king changes his state) namespace Kingdom { delegate Object Notify(King k); … } Event definition: a field with a multi-set of delegates namespace Kingdom { class King: Man { public event Notify when_ill, when_happy; … } It is possible (but not very useful) to define a field which contains a single delegate. class KING: King { public Notify queen_listner; }

30 Registration of an Actual Delegate Actual Delegate: a function for notification namespace Kingdom { … abstract class Man { public Man happy(Object other) { Console.WriteLine(this + " is happy to hear that " + other + " is happy."); return this; } } … } … Register a delegate: with += operator namespace Kingdom { abstract class Man { virtual public void serve(King k) { k.when_happy += new Notify(happy); } }

31 Classes Citizen and Nobleman namespace Kingdom { … sealed class Citizen: Man { public Citizen(String name) : base(name) { } override public String ToString() { return "Citizen " + Name; } class Nobleman: Man { public Nobleman(String name) : base(name) { } override public String title() {return Name; } public Nobleman ill(Object other) { Console.WriteLine(this + " is sorry to hear that " + other + " is ill."); return this; } override public void serve(King k) { base.serve(k); k.when_ill += new Notify(ill); } } { Citizen sealed Nobleman concrete

32 static class Life { static void Main() { King R = new King("Richard"), G = new King("George"); Citizen a = new Citizen("Al"), b = new Citizen("Bob"); Nobleman v = new Nobleman("Virgil"); a.serve(R); b.serve(R); b.serve(G); v.serve(R); G.serve(R); R.ill(); R.become_happy(); Console.WriteLine("----"); G.become_ill(); G.become_happy(); Console.WriteLine("----"); } Main Application Al Bob Virgil Richard George Life static

33 Output Virgil is sorry to hear that His Majesty, King Richard is ill. Citizen Al is happy to hear that His Majesty, King Richard is happy. Citizen Bob is happy to hear that His Majesty, King Richard is happy. Virgil is happy to hear that His Majesty, King Richard is happy. His Majesty, King George is happy to hear that His Majesty, King Richard is happy Citizen Bob is happy to hear that His Majesty, King George is happy Scenario 1.King Richard becomes ill 2.King Richard becomes happy 3.King George becomes happy Remember, every man is happy when a king he serves is happy, but only a Noblemen is to be notified when his king is ill. Al Bob Virgil Richard George

34 Delegate Variance Delegate definition: delegate Object Notify(King k); Actual delegates: public Man happy(Object other) {…} public Nobleman ill(Object other){…} Variance: –Return Type: Co-Variant –Arguments Type: Contra-Variant –Static / Non-static: both static and non-static actuals may be used. Compatibility Rules: Allow a specific listener to subscribe to a more general event distribution channel –It is OK to pass an actual King argument to the listener happy(Object other) –Event triggering expects an Object, and is type safe even if a Man or a Nobleman is returned.

35 Delegate Type Hierarchy using System; using System.Reflection; delegate Object MyDelegateType(Type o); public static class DelegateTypeHierarchy { private static String pName(Type t) { as before... } private static void ancestory(Object o){ as before … } public static void Main() { ancestory(new MyDelegateType(pName)); } } using System; using System.Reflection; delegate Object MyDelegateType(Type o); public static class DelegateTypeHierarchy { private static String pName(Type t) { as before... } private static void ancestory(Object o){ as before … } public static void Main() { ancestory(new MyDelegateType(pName)); } } MyDelegateType inherits from System.MulticastDelegate System.MulticastDelegate inherits from System.Delegate System.Delegate inherits from System.Object System.Object inherits from null

36 Summary – C# Unique Features Properties and Indexers: implement fields with functions –Conforms to Eiffel Principle of Uniform Reference. Delegates: type safe function pointers –Events: list of delegates. Static classes Seamless integration of value semantics –Including nullable values. Default Strict Inheritance –override and new keywords