Skip to content

Instantly share code, notes, and snippets.

@horsdal
Created March 13, 2013 21:09
Show Gist options
  • Save horsdal/5156242 to your computer and use it in GitHub Desktop.
Save horsdal/5156242 to your computer and use it in GitHub Desktop.
public class Registrant
{
private readonly List<Course> courseWishes = new List<Course>();
public IEnumerable<Course> CourseWishes { get { return courseWishes; } }
public string Name { get; private set; }
public Registrant(string name)
{
Name = name;
}
public void WishForCourse(Course course)
{
if (!courseWishes.Contains(course))
courseWishes.Add(course);
}
public override bool Equals(object obj)
{
return
obj != null
&& GetType() == obj.GetType()
&& Name.Equals(((Registrant) obj).Name);
}
// some hashcode implementation ....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment