Click or drag to resize

FindUsersRequest Class

Retrieves a list of users from the server which match the specified criteria.
Inheritance Hierarchy
SystemObject
  BaseRequest
    Sfs2X.RequestsFindUsersRequest

Namespace:  Sfs2X.Requests
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: 1.8.0.0 (1.8.0)
Syntax
C#
public class FindUsersRequest : BaseRequest
Constructors
  NameDescription
Public methodFindUsersRequest(MatchExpression)
See FindUsersRequest(MatchExpression, string, int) constructor.
Public methodFindUsersRequest(MatchExpression, Room)
See FindUsersRequest(MatchExpression, string, int) constructor.
Public methodFindUsersRequest(MatchExpression, String)
See FindUsersRequest(MatchExpression, string, int) constructor.
Public methodFindUsersRequest(MatchExpression, Room, Int32)
See FindUsersRequest(MatchExpression, string, int) constructor.
Public methodFindUsersRequest(MatchExpression, String, Int32)
Creates a new FindUsersRequest instance.
Top
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:
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"]);        // UWP
}
See Also