Introducing 

Prezi AI.

Your new presentation assistant.

Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.

Loading…
Transcript

Enumerators, Delegates, LINQ, Operator Overloading

Enumerating Collections

interface IEnumerable

{

IEnumerator GetEnumerator();

}

interface IEnumerator

{

object Current {get;}

bool MoveNext();

void Reset();

}

IEnumerator<T>

Delegate is a reference to a method

They delegate processing to referenced method when called

.NET delegates List<T> : Find and Exists methods

support Func<T,TResult> and Action<T> delegates

distinct machineries for distinct tasks

-shaping

-welding-

-painting

-single controller class

Adapter

to add methods to delegates who do not follow its format

Enabling notifications by using events

event delgatetype eventname

eventname+=method

eventname-=methodname

events

Events

Querying in-memory data using query expressions

(ID,firstname,lastname,companyname)

(companyname,city,country)

Select()

- Retrieve the first names of all customers

Retrieve the first and last names of all customers

IEnumerable

JOIN

Query Operators

Employee Tree

OPERATOR OVERLOADING

features of operators:

-operate on operands

-semantic varies

-precedence

- associativity

-unary and binary

- cannot change precedence and associativity

- cannot change multiplicity of operators

- cannot invent new operator symbols

- cannot change meaning, when applied to built in types

- some operators cannot be overloaded

operator overloading

- method like syntax

-keyword operator

- should be public and static

-cannot be virtual, abstract, sealed or override

- number of parameters depend on operator multiplicity

-atleast one of the parameter should be containing type

Creating symmetric operators

compound assignment

Overloading increment and decrement operators

operator pairs

Type Conversion

Implicit

Explicit

User defined conversions

(keywords -implicit, explicit

Creating symmetric operators

Enumerating elements

Learn more about creating dynamic, engaging presentations with Prezi