Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created August 10, 2017 04:34
Show Gist options
  • Save Fhernd/364aa64eabf08026bbdce22ef37aed9e to your computer and use it in GitHub Desktop.
Save Fhernd/364aa64eabf08026bbdce22ef37aed9e to your computer and use it in GitHub Desktop.
Definición de la clase Gente que implementa IEnumerable.
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