MembershipProvider.FindUsersByName(String, Int32, Int32, Int32) 方法

定义

获取一个成员资格用户的集合,其中的用户名包含要匹配的指定用户名。Gets a collection of membership users where the user name contains the specified user name to match.

public:
 abstract System::Web::Security::MembershipUserCollection ^ FindUsersByName(System::String ^ usernameToMatch, int pageIndex, int pageSize, [Runtime::InteropServices::Out] int % totalRecords);
public abstract System.Web.Security.MembershipUserCollection FindUsersByName (string usernameToMatch, int pageIndex, int pageSize, out int totalRecords);
abstract member FindUsersByName : string * int * int * int -> System.Web.Security.MembershipUserCollection
Public MustOverride Function FindUsersByName (usernameToMatch As String, pageIndex As Integer, pageSize As Integer, ByRef totalRecords As Integer) As MembershipUserCollection

参数

usernameToMatch
String

要搜索的用户名。The user name to search for.

pageIndex
Int32

要返回的结果页的索引。The index of the page of results to return. pageIndex 从零开始。pageIndex is zero-based.

pageSize
Int32

要返回的结果页的大小。The size of the page of results to return.

totalRecords
Int32

匹配用户的总数。The total number of matched users.

返回

MembershipUserCollection

包含一页 pageSizeMembershipUser 对象的 MembershipUserCollection 集合,这些对象从 pageIndex 指定的页开始。A MembershipUserCollection collection that contains a page of pageSizeMembershipUser objects beginning at the page specified by pageIndex.

示例

有关实现的示例 MembershipProvider ,请参阅 实现配置文件提供程序For an example of a MembershipProvider implementation, see Implementing a Profile Provider.

注解

FindUsersByName 返回一个成员资格用户列表,其中的用户名与为配置的属性提供的名称匹配 usernameToMatch ApplicationNameFindUsersByName returns a list of membership users where the user name matches the supplied usernameToMatch for the configured ApplicationName property. 如果数据源支持其他搜索功能(如通配符),则可以为用户名提供更广泛的搜索功能。If your data source supports additional search capabilities, such as wildcard characters, you can provide more extensive search capabilities for user names.

返回的结果 FindUsersByName 是由 pageIndex 和参数约束的 pageSizeThe results returned by FindUsersByName are constrained by the pageIndex and pageSize parameters. pageSize参数标识 MembershipUser 要在集合中返回的对象的数目 MembershipUserCollectionThe pageSize parameter identifies the number of MembershipUser objects to return in the MembershipUserCollection collection. pageIndex参数标识要返回的结果页,其中0标识第一页。The pageIndex parameter identifies which page of results to return, where 0 identifies the first page. totalRecords参数是 out 设置为与值匹配的成员资格用户总数的参数 usernameToMatchThe totalRecords parameter is an out parameter that is set to the total number of membership users that matched the usernameToMatch value. 例如,如果找到13个用户(其中 usernameToMatch 匹配部分或整个用户名),并且 pageIndex 值为1且为 pageSize 5,则 MembershipUserCollection 将包含返回的第6个到第十个用户。For example, if 13 users were found where usernameToMatch matched part of or the entire user name, and the pageIndex value was 1 with a pageSize of 5, then the MembershipUserCollection would contain the sixth through the tenth users returned. totalRecords 将设置为13。totalRecords would be set to 13.

适用于