Retrieves a list of users from the server which match the specified criteria.

Namespace: Sfs2X.Requests
Assembly: SmartFox2X (in SmartFox2X.dll) Version: 1.7.3.0 (1.7.3)

Syntax

C#
public class FindUsersRequest : BaseRequest

Remarks

By providing a matching expression and a search scope (a Room, a Group or the entire Zone), SmartFoxServer can find those users matching the passed criteria and return them by means of the USER_FIND_RESULT event.

Examples

The following example looks for all the users whose "age" User Variable is greater than 29:
 Copy imageCopy
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.USER_FIND_RESULT, OnUserFindResult);
    // Create a matching expression to find users with an "age" variable greater than 29:
    MatchExpression expr = new MatchExpression("age", NumberMatch.GREATER_THAN, 29);
    // Find the users
    sfs.Send( new FindUsersRequest(expr) );
}
void OnUserFindResult(BaseEvent evt) {
    Console.WriteLine("Users found: " + (List<User>)evt.Params["users"]);                         // .Net / Unity
    System.Diagnostics.Debug.WriteLine("Users found: " + (List<User>)evt.Params["users"]);        // Windows Universal
}

Inheritance Hierarchy

System..::..Object
  BaseRequest
    Sfs2X.Requests..::..FindUsersRequest

See Also