ScrewTurn.Wiki.UsersStorageProvider.GetGroupsForUser C# (CSharp) Method

GetGroupsForUser() private method

Gets the names of all the groups a user is member of.
private GetGroupsForUser ( string user, UserGroup groups ) : string[]
user string The username.
groups UserGroup The groups.
return string[]
        private string[] GetGroupsForUser(string user, UserGroup[] groups)
        {
            List<string> result = new List<string>(3);

            foreach(UserGroup group in groups) {
                if(Array.Find(group.Users, delegate(string u) { return u == user; }) != null) {
                    result.Add(group.Name);
                }
            }

            return result.ToArray();
        }