SlideShare a Scribd company logo
Generics & Iterators
             Programming in C#




                tnngo2@gmail.com
Generics
What is generics?
What is generics?




      ensure type-safety
             the compiler will validate types while compiling, and throw an error if you try to
             assign the wrong type to a variable.
14   generics and iterators
Benefits

      No Casting, and Boxing
      Increased Performance
      Ensured strongly-typed Model
      Reduced run-time errors
Namespace for Generics

      System.Collection.Generic
Namespace for Generics
Implementation

     https://gist.github.com/2499823
Constraints

      https://gist.github.com/2505556
Inheriting generic classes
Generic Methods

     virtual
     override
     abstract

     https://gist.github.com/2507425
Generic Interfaces

      https://gist.github.com/2506990
Generic Interface Constraints

      https://gist.github.com/2507482
Question?

     https://gist.github.com/2507914
Iterators
Iterators

       is a way of navigating through the values in a collection.

       specify the way values are generated when the foreach statement
       accesses the elements within a collection.
Benefits

      Perform Simplified Iteration
      Return Infinite values
      Reduce Complexity
      Save Memory
Implementation

     https://gist.github.com/2507655
Question?

     What is the difference between IEnumerator and IEnumerable?
Question?

      What is the difference between IEnumerator and IEnumerable?



  IEnumerable

  public IEnumerator GetEnumerator();

  IEnumerator

  public object Current;
  public void Reset();
  public bool MoveNext();

More Related Content

ODP
Rtt preso
PPTX
Interpreter RPG to Java
PDF
Preview of Groovy 3
PDF
How to distinguish the app was repackaged or not?
KEY
Tdd With Groovy
PPT
Struts2 in a nutshell
PDF
Commenting in Agile Development
PPT
Unit Testing RPG with JUnit
Rtt preso
Interpreter RPG to Java
Preview of Groovy 3
How to distinguish the app was repackaged or not?
Tdd With Groovy
Struts2 in a nutshell
Commenting in Agile Development
Unit Testing RPG with JUnit

Viewers also liked (20)

PPTX
Plc (components)
PPTX
MSU DL Workshop Aug 13 2013
PPTX
Fighting cleanup routines
PDF
Lesson 1 for 1st cycle school
PPT
Privatsparande
PDF
Slides open stack emily_updated_2
PDF
店舗間のクーポンプロモーション戦略 201307
PDF
Andersson: Koulurauha - jokaisen oikeus
PPTX
Lesson1 - Fall 2013
PDF
Hietanen-Peltola: Kouluympäristön terveellisyys ja turvallisuus sekä kouluyht...
PDF
Exposicion redes sociales, buscadores, correos y paginas
PPT
English in the FLS, Bulgaria
PPT
Маркетинг план юст
PDF
Employee engagement
PDF
A guide to selling and buying a business 1.0
PDF
Slideshow by RLG
PPSX
PDF
SSA 2015 Onderzoek "Integrale Beveiliging: Hoe werken IT beveiliging en fysie...
PDF
Offshore Operations Maintenance[2]
PDF
Kimpton Hotels Mid-Atlantic Region Brochure
Plc (components)
MSU DL Workshop Aug 13 2013
Fighting cleanup routines
Lesson 1 for 1st cycle school
Privatsparande
Slides open stack emily_updated_2
店舗間のクーポンプロモーション戦略 201307
Andersson: Koulurauha - jokaisen oikeus
Lesson1 - Fall 2013
Hietanen-Peltola: Kouluympäristön terveellisyys ja turvallisuus sekä kouluyht...
Exposicion redes sociales, buscadores, correos y paginas
English in the FLS, Bulgaria
Маркетинг план юст
Employee engagement
A guide to selling and buying a business 1.0
Slideshow by RLG
SSA 2015 Onderzoek "Integrale Beveiliging: Hoe werken IT beveiliging en fysie...
Offshore Operations Maintenance[2]
Kimpton Hotels Mid-Atlantic Region Brochure
Ad

Similar to 14 generics and iterators (20)

PDF
The Art of Unit Testing - Towards a Testable Design
KEY
Testing w-mocks
PPTX
The tests are trying to tell you something@VoxxedBucharest.pptx
PDF
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
PDF
Working Effectively With Legacy Perl Code
PDF
JAVA Collection and generics
KEY
Test First, Refresh Second: Web App TDD in Grails
PPT
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
PDF
Level Up Your Integration Testing With Testcontainers
PDF
New types of tests for Java projects
KEY
Test First Refresh Second: Test-Driven Development in Grails
PPTX
Annotation processing
PDF
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
PDF
Advanced Java Testing
PPTX
OpenDaylight Developer Experience 2.0
PDF
Re Sharper4vs Plain Visual Studio2008
PDF
Testing Django Applications
PPTX
Microsoft c#.net online training.ppsx
PDF
Unit Testing like a Pro - The Circle of Purity
PPTX
MICROSOFT C#.NET ONLINE TRAINING
The Art of Unit Testing - Towards a Testable Design
Testing w-mocks
The tests are trying to tell you something@VoxxedBucharest.pptx
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
Working Effectively With Legacy Perl Code
JAVA Collection and generics
Test First, Refresh Second: Web App TDD in Grails
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
Level Up Your Integration Testing With Testcontainers
New types of tests for Java projects
Test First Refresh Second: Test-Driven Development in Grails
Annotation processing
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Advanced Java Testing
OpenDaylight Developer Experience 2.0
Re Sharper4vs Plain Visual Studio2008
Testing Django Applications
Microsoft c#.net online training.ppsx
Unit Testing like a Pro - The Circle of Purity
MICROSOFT C#.NET ONLINE TRAINING
Ad

More from Tuan Ngo (20)

PDF
Introduction of cg program for portal 20120424 en
PDF
Net framework
PDF
15 anonymous methods, partial types and nullable types
PDF
13 collections
PDF
11 exception handling
PDF
12 events and delegates
PDF
9 properties & indexers
PDF
10 namespace
PDF
8 abstract classes and interfaces
PDF
7 inheritance and polymorphism
PDF
5 arrays
PDF
6 class and methods
PDF
3 statements and operators
PDF
4 c# programming constructs
PDF
1 get started with c#
PDF
2 variables and data types
PDF
Jdbc 7
PDF
Jdbc 6
PDF
Jdbc 3
PDF
Jdbc 2
Introduction of cg program for portal 20120424 en
Net framework
15 anonymous methods, partial types and nullable types
13 collections
11 exception handling
12 events and delegates
9 properties & indexers
10 namespace
8 abstract classes and interfaces
7 inheritance and polymorphism
5 arrays
6 class and methods
3 statements and operators
4 c# programming constructs
1 get started with c#
2 variables and data types
Jdbc 7
Jdbc 6
Jdbc 3
Jdbc 2

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PPTX
A Presentation on Artificial Intelligence
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
Teaching material agriculture food technology
PDF
Machine learning based COVID-19 study performance prediction
PDF
cuic standard and advanced reporting.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
KodekX | Application Modernization Development
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
Approach and Philosophy of On baking technology
A Presentation on Artificial Intelligence
Encapsulation_ Review paper, used for researhc scholars
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Big Data Technologies - Introduction.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Reach Out and Touch Someone: Haptics and Empathic Computing
Teaching material agriculture food technology
Machine learning based COVID-19 study performance prediction
cuic standard and advanced reporting.pdf
Empathic Computing: Creating Shared Understanding
Unlocking AI with Model Context Protocol (MCP)
NewMind AI Weekly Chronicles - August'25 Week I
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Review of recent advances in non-invasive hemoglobin estimation
Spectral efficient network and resource selection model in 5G networks
KodekX | Application Modernization Development
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Per capita expenditure prediction using model stacking based on satellite ima...

14 generics and iterators