MembershipProvider.FindUsersByName(String, Int32, Int32, Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个成员资格用户的集合,其中的用户名包含要匹配的指定用户名。
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
要搜索的用户名。
- pageIndex
- Int32
要返回的结果页的索引。 pageIndex
从零开始。
- pageSize
- Int32
要返回的结果页的大小。
- totalRecords
- Int32
匹配用户的总数。
返回
包含一页 pageSize
MembershipUser 对象的 MembershipUserCollection 集合,这些对象从 pageIndex
指定的页开始。
示例
有关实现的示例 MembershipProvider ,请参阅 实现配置文件提供程序。
注解
FindUsersByName 返回一个成员资格用户列表,其中的用户名与为配置的属性提供的名称匹配 usernameToMatch
ApplicationName 。 如果数据源支持其他搜索功能(如通配符),则可以为用户名提供更广泛的搜索功能。
返回的结果 FindUsersByName 是由 pageIndex
和参数约束的 pageSize
。 pageSize
参数标识 MembershipUser 要在集合中返回的对象的数目 MembershipUserCollection 。 pageIndex
参数标识要返回的结果页,其中0标识第一页。 totalRecords
参数是 out
设置为与值匹配的成员资格用户总数的参数 usernameToMatch
。 例如,如果找到13个用户(其中 usernameToMatch
匹配部分或整个用户名),并且 pageIndex
值为1且为 pageSize
5,则 MembershipUserCollection 将包含返回的第6个到第十个用户。 totalRecords
将设置为13。