Created
August 10, 2017 04:34
-
-
Save Fhernd/364aa64eabf08026bbdce22ef37aed9e to your computer and use it in GitHub Desktop.
Definición de la clase Gente que implementa IEnumerable.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System; | |
namespace cap07.usoienumerator | |
{ | |
public class Gente : IEnumerable | |
{ | |
private Persona[] personas; | |
public Gente(Persona[] personas) | |
{ | |
this.personas = new Persona[personas.Length]; | |
for(int i = 0; i < personas.Length; ++i) | |
{ | |
this.personas[i] = personas[i]; | |
} | |
} | |
IEnumerator IEnumerable.GetEnumerator() | |
{ | |
return (IEnumerator) GetEnumerator(); | |
} | |
public GenteEnumerator GetEnumerator() | |
{ | |
return new GenteEnumerator(personas); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment