Skip to content

Instantly share code, notes, and snippets.

@njonsson
Created May 26, 2010 00:17
Show Gist options
  • Save njonsson/413865 to your computer and use it in GitHub Desktop.
Save njonsson/413865 to your computer and use it in GitHub Desktop.
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