-
-
Save dcomartin/69f42b565ab3b0eb89d70908db41400a 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
| public class GroupChat | |
| { | |
| private const int MaxMembers = 100_000; | |
| public Guid Id { get; private set; } | |
| public int MemberCount { get; private set; } | |
| public GroupChat(Guid id) | |
| { | |
| Id = id; | |
| MemberCount = 0; | |
| } | |
| public void AddMember() | |
| { | |
| if (MemberCount >= MaxMembers) | |
| throw new InvalidOperationException("GroupChat is full"); | |
| MemberCount++; | |
| } | |
| public void RemoveMember() | |
| { | |
| if (MemberCount == 0) | |
| throw new InvalidOperationException("No members to remove"); | |
| MemberCount--; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment