Created
May 26, 2010 00:17
-
-
Save njonsson/413865 to your computer and use it in GitHub Desktop.
This file contains hidden or 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; | |
using System.Collections.Generic; | |
class Nightclub | |
{ | |
private readonly List<Person> occupants = new List<Person>(); | |
public Nightclub() | |
{ | |
occupants = new List<Person>(); | |
} | |
public Func<Person, bool> Bouncer { get; set; } | |
public Person[] Occupants | |
{ | |
get { return occupants.ToArray(); } | |
} | |
public bool Enter(Person person) | |
{ | |
if ((Bouncer != null) && !Bouncer(person)) return false; | |
occupants.Add(person); | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment