Represents a single group. A group has a name and zero or more users. Users are tracked by name. More...
Public Member Functions | |
bool | ContainsUser (string name) |
Determine if the specified user is in this group. This is a case- sensitive search. | |
void | AddUser (string name) |
Add the specified user to this group. If the user is already in the group, the operation is ignored. | |
void | RemoveUser (string name) |
Remove a user from this group. If the user is not in the group then the operation is ignored. | |
override bool | Equals (object? obj) |
Override to compare a Group or string to this Group. | |
override int | GetHashCode () |
Generate a hash code for this instance. | |
Package Functions | |
Group (string name) | |
Constructor. | |
Properties | |
string | Name [get] |
The name of the group (read-only). | |
string[] | Users [get] |
The names of users in this group (read-only). | |
Private Attributes | |
List< string > | _users = new List<string>() |
The list of users in this group. | |
Represents a single group. A group has a name and zero or more users. Users are tracked by name.
Definition at line 26 of file Mediator_Group_Classes.cs.
|
inlinepackage |
Constructor.
name | Name of the group to use. |
Definition at line 37 of file Mediator_Group_Classes.cs.
References Group.Name.
|
inline |
Add the specified user to this group. If the user is already in the group, the operation is ignored.
name | Name of the user to add. Cannot be null or empty. |
ArgumentNullException | The 'name' parameter must specify a user name. |
Definition at line 75 of file Mediator_Group_Classes.cs.
References Group._users, and Group.ContainsUser().
Referenced by UserGroupMediator.AddUserToGroup().
|
inline |
Determine if the specified user is in this group. This is a case- sensitive search.
name | Name of the user to look for. |
Definition at line 64 of file Mediator_Group_Classes.cs.
References Group._users.
Referenced by Group.AddUser(), UserGroupMediator.GetGroupsWithUser(), UserGroupMediator.IsUserInGroup(), Group.RemoveUser(), and UserGroupMediator.RemoveUserFromAllGroups().
|
inline |
Override to compare a Group or string to this Group.
obj | A string or an instance of the Group class. |
Definition at line 107 of file Mediator_Group_Classes.cs.
References Group.Name.
|
inline |
Generate a hash code for this instance.
Because we overrode Equals(), we need to override GetHashCode().
Definition at line 130 of file Mediator_Group_Classes.cs.
References Group.Name.
|
inline |
Remove a user from this group. If the user is not in the group then the operation is ignored.
name | The name of the user to remove. |
Definition at line 94 of file Mediator_Group_Classes.cs.
References Group._users.
Referenced by UserGroupMediator.RemoveUserFromAllGroups(), and UserGroupMediator.RemoveUserFromGroup().
|
private |
The list of users in this group.
Definition at line 31 of file Mediator_Group_Classes.cs.
Referenced by UserList._SearchForUser(), UserList.AddUser(), Group.AddUser(), Group.ContainsUser(), UserList.FindUser(), UserList.RemoveUser(), Group.RemoveUser(), UserList.UserNames(), and Group.Users().
|
get |
The name of the group (read-only).
Definition at line 45 of file Mediator_Group_Classes.cs.
Referenced by Group.Equals(), Group.GetHashCode(), Group.Group(), Visitor_Shop.PickupOrder(), Visitor_Shop.PlaceOrder(), and EntryInformation.ToString().
|
get |
The names of users in this group (read-only).
Definition at line 50 of file Mediator_Group_Classes.cs.
Referenced by UserGroupMediator.GetUsersInGroup().